-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-436 Change max_pool_size to limit the maximum concurrent connections #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ctions rather than just the idle connections in the pool. Also add support for waitQueueTimeoutMS and waitQueueMultiple.
@ajdavis @behackett Good to pull? |
Thanks Justin; I'm applying this patch locally and doing some final testing and fixup before we push to master. So don't change anything else, and thanks again for your patience! |
ping Are there some changes you'd like me to make so this can be pulled? Do you have a patch or pull request I should apply before this can be pulled? |
Hi Justin, this is very much not forgotten. There are subtle problems in On Wed, Apr 24, 2013 at 2:45 AM, Justin Patrin [email protected]:
|
Ah, I see. If you have any patches for me I'd love to have them so I can help with the effort. I'm fairly sure that the issue I uncovered was existing, but simply not triggered by existing tests. I'll see if I can write a test in upstream master to trigger the issue. As I mentioned elsewhere, I wasn't able to track down anything wrong with the code to cause the random socket leaks in Python 2.6. It was definitely the threadlocal that was not being reclaimed that was causing on_thread_died not to get called, but nothing appeared to be holding a reference to it. However, if I remember correctly, when I had my extra monitor thread working, I believe the threadlocal was cleaned up when the monitor cleaned up the socket... I'm not 100% sure of that, though. |
I'm suspicious that there really is a reclamation bug in PyMongo with old https://gist.github.com/ajdavis/5438545 http://bugs.python.org/issue1868 So that shows the possibility of a problem with our thread-cleanup https://github.com/mongodb/mongo-python-driver/commits/test-socket-reclamation-2.6 Apparently if each thread calls start_request more times than |
OK, here's that bug: https://jira.mongodb.org/browse/PYTHON-509 Once my fix for that is merged we'll apply your patch on top of the fix and On Wed, Apr 24, 2013 at 1:17 PM, A. Jesse Jiryu Davis [email protected]:
|
Nice find. Adding a lock is a much better solution than my extra watcher thread. |
… into PYTHON-436 Conflicts: test/test_pooling_base.py
I've pulled from upstream and fixed the conflict in the tests. |
Cool, but don't worry about it; I'm going to rebase your patch on this fix On Wed, Apr 24, 2013 at 10:18 PM, Justin Patrin [email protected]:
|
The tests were failing after I merged and I tracked it down to the CreateAndReleaseSocket tests having a smaller max_pool_size than nthreads, which of course breaks now that max_pool_size is strict. 9528e95 fixes this by waiting for a min of nthreads or max_pool_size at a time. |
FYI I have your patch ready to go in my repo. Your work is done. We're going to delay merging it for a bit longer while we push a bugfix release PyMongo 2.5.1. Your patch will go out in PyMongo 2.6. |
Ok, sounds good. :-) Did you get my test fixes as well? On Fri, Apr 26, 2013 at 5:53 AM, A. Jesse Jiryu Davis <
|
Conflicts: test/test_pooling_base.py
… just greenlet (i.e. PyPy)
… into PYTHON-436 Conflicts: pymongo/mongo_replica_set_client.py test/high_availability/test_ha.py
pymongo 2.5.1 is out and this branch has been merged with upstream/master and tests are passing: I suggest that this patch and Pull Request #176 be merged together to decrease divergence. |
We've merged this manually. Thanks again! |
PYTHON-436 Change max_pool_size to limit the maximum concurrent connections rather than just the idle connections in the pool. Also add support for waitQueueTimeoutMS and waitQueueMultiple.
https://jira.mongodb.org/browse/PYTHON-436
See previous pull request for history:
#163