Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2477

periodic_executor.py time.sleep causing segment fault

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.11.2
    • Component/s: None
    • None
    • Environment:
      Pymonogo = 3.11.2
      MongoDB = 4.2.11
      OS = Debian 10.7 arm64

      Hi there,

      I haven't been able to find much more information regarding this issue, the issue i'm experiencing looks very similar to: https://jira.mongodb.org/browse/PYTHON-1442

        File "/usr/local/lib/python3.7/dist-packages/pymongo/periodic_executor.py", line 140 in _run
        File "/usr/lib/python3.7/threading.py", line 865 in run
        File "/usr/lib/python3.7/threading.py", line 917 in _bootstrap_inner
        File "/usr/lib/python3.7/threading.py", line 885 in _bootstrap

      My application is a lot simpler than the one listed in PYTHON-1442, it consists of an RFID callback to write a tag into the database, and then an interval loop which queries all records and performs a http request and send the results off. This segment fault occurs roughly every hour - at line 140 time.sleep()

      A simplified version of the code im using roughly looks like this:

      mongo = MongoClient()
      db = mongo['rfid']
      
      def callback_method(tag):
          db.records.insert_one(tag)
      
      while True:
          cursor = db.records.find({})
          for c in cursor:
              if requests.post("url",json=c).status_code == 200:
                  db.records.delete_one(c)
          sleep.time(30)

      Any pointers as to why this may be happening?

      Thanks!

       

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            kendrickluong@gmail.com Kendrick Luong
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: