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

PyMongo causes a segmentation fault (randomly?) when using Motor async framework

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.0
    • Component/s: asyncio, tornado
    • None
    • Environment:

      My multi-threaded application running on asyncio and the tornado framework causes a segmentation fault randomly (can take 20 minutes or 4 days.) Some kind of condition seems to cause the unpack_response function from message.py to cause a segmentation fault. The trace of all threads upon crash are doing nothing interesting (mostly waiting) but one thread upon all recorded crashes consistently reads:

      Current thread 0x00007f62cb7fe700 (most recent call first):
       File "/home/dalofeco/.local/lib/python3.6/site-packages/pymongo/message.py", line 1465 in unpack_response
       File "/home/dalofeco/.local/lib/python3.6/site-packages/pymongo/cursor.py", line 1067 in _unpack_response
       File "/home/dalofeco/.local/lib/python3.6/site-packages/pymongo/cursor.py", line 978 in __send_message
       File "/home/dalofeco/.local/lib/python3.6/site-packages/pymongo/cursor.py", line 1104 in _refresh
       File "/home/dalofeco/.local/lib/python3.6/site-packages/pymongo/cursor.py", line 1189 in next
       File "/home/dalofeco/.local/lib/python3.6/site-packages/pymongo/collection.py", line 1262 in find_one
       File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56 in run
       File "/usr/lib/python3.6/concurrent/futures/thread.py", line 69 in _worker
       File "/usr/lib/python3.6/threading.py", line 864 in run
       File "/usr/lib/python3.6/threading.py", line 916 in _bootstrap_inner
       File "/usr/lib/python3.6/threading.py", line 884 in _bootstrap

      This was collected with python's faulthandler. Note that this issue only arose after switching to the asynchronous Motor library, which seemed only natural with a Tornado-based asynchronous application. 

        1. motor-323-doc.bson
          265 kB
        2. backtrace.txt
          25 kB

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            dalofeco Daniel Lopez
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: