pyMongo client doesn't reuse / close opened sockets

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.6.3
    • Component/s: None
    • Environment:
      ubuntu 12.04 32 bits
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      in a module :

      import pymongo

      mongo_client = pymongo.MongoClient()
      mongo_db = mongo_client.my_db

      web handler, get :
      mongo_db.db['my_collection'].save(

      {'name': 'the name'}

      )

      Doing this on a python web server that is very lightly used and the number of sockets opened will increase and go over 1020 and cause the server to refuse new connections to the mongo database

      One way to avoid this : play with max_pool_size and waitQueueMultiple with waitQueueMultiple * max_pool_size < ulimit when creating the client.

      However I think that pymongo client should have closed the unused sockets / try to reuse them instead of keep opening them, even though waitQueueMultiple=None by default.

      See thread :
      http://stackoverflow.com/questions/20540129/ever-increasing-number-of-opened-sockets-on-python-web-server/20548601?noredirect=1#comment30861576_20548601

            Assignee:
            Bernie Hackett
            Reporter:
            ThomasJ
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: