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

Pymongo: network_timeout not correctly working

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      pymongo 1.5-1.9

      The following script causes an error if using a network_work other than None although mongodb
      is running from the beginning:

      conn = pymongo.Connection(port=10200, network_timeout=1)
      #conn = pymongo.Connection(port=10200, network_timeout=5)
      db = conn.foo
      coll = db.bar

      data = dict()conn = pymongo.Connection(port=10200, network_timeout=1)
      #conn = pymongo.Connection(port=10200, network_timeout=5)
      db = conn.foo
      coll = db.bar

      data = dict()
      for i in range(10):
      data[str(i)] = '*' * 100

      for i in range(100000):
      if i % 10000 == 0:
      print i
      d = data.copy()
      d['id'] = i
      coll.insert(d)
      for i in range(10):
      data[str(i)] = '*' * 100

      for i in range(100000):
      if i % 10000 == 0:
      print i
      d = data.copy()
      d['id'] = i
      coll.insert(d)

      suxmac2:~ ajung$ foo/bin/python /Users/ajung/sandboxes/occ/xx.py
      0
      Traceback (most recent call last):
      File "/Users/ajung/sandboxes/occ/xx.py", line 19, in <module>
      coll.insert(d)
      File "/Users/ajung/foo/lib/python2.6/site-packages/pymongo-1.9-py2.6-macosx-10.6-x86_64.egg/pymongo/collection.py", line 270, in insert
      check_keys, safe, kwargs), safe)
      File "/Users/ajung/foo/lib/python2.6/site-packages/pymongo-1.9-py2.6-macosx-10.6-x86_64.egg/pymongo/connection.py", line 646, in _send_message
      raise AutoReconnect(str(e))
      pymongo.errors.AutoReconnect: [Errno 35] Resource temporarily unavailable

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            yet@gmx.de Andreas Jung
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: