On Mac, synchrotest hangs at the point where:
- the Nose testrunner tries to import the "test" module from PyMongo
- the test module starts creating a ClientContext object
- the test module runs client.admin.command('getCmdLineOpts')
- Synchro intervenes, runs the command via Motor, which schedules the command on a thread pool
- the command runs on a thread, tries to make a ClientSession
- ClientSession generates an lsid with uuid.uuid4().bytes
- the uuid code imports "os" in order to do some system work to get random bytes
- the import lock is already held by the main thread
PyMongo's test module probably shouldn't do as much work at module-import time as it does, such modules are prone to this sort of deadlock. It's only a problem in Motor, for now, because Motor defers PyMongo methods to threads. It's only a problem on Mac because (I think) the order of events is influenced by the order that Python lists directories while importing modules, and that order differs on Linux and Mac.
- depends on
-
PYTHON-1563 Avoid import deadlocks in test suite
- Closed