Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-226

synchrotest hangs on Mac

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.0
    • Affects Version/s: None
    • Component/s: Tests
    • None

      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.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: