-
Notifications
You must be signed in to change notification settings - Fork 5
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
set use_tweens
to True when using the invoke_subrequest
pyramid method
#203
Conversation
remove pool_threadlocal which is equivalent to use_threadlocal which is deprecated
Codecov Report
@@ Coverage Diff @@
## master #203 +/- ##
==========================================
- Coverage 71.46% 71.44% -0.03%
==========================================
Files 94 94
Lines 6848 6846 -2
==========================================
- Hits 4894 4891 -3
- Misses 1954 1955 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will postpone this PR a little bit as it cause twitcher to block all access :
2019-07-08 14:13:01,415 INFO [TWITCHER:60][waitress] Using adapter: '<class 'magpie.adapter.MagpieAdapter'>'
twitcher | 2019-07-08 14:13:01,418 ERROR [TWITCHER:33][waitress] unknown error
twitcher | Traceback (most recent call last):
twitcher | File "/opt/birdhouse/src/twitcher/twitcher/tweens.py", line 27, in ows_security_tween
twitcher | security.check_request(request)
twitcher | File "/opt/local/src/magpie/magpie/adapter/magpieowssecurity.py", line 42, in check_request
twitcher | httpError=HTTPForbidden, msgOnFail="Service query by name refused by db.")
twitcher | File "/opt/local/src/magpie/magpie/api/exception.py", line 237, in evaluate_call
twitcher | contentType=contentType)
twitcher | File "/opt/local/src/magpie/magpie/api/exception.py", line 318, in raise_http
twitcher | raise resp
twitcher | pyramid.httpexceptions.HTTPForbidden: Access was denied to this resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a fix for twitcher before merging
so that pyramid_tm can close the connections properly
is already managed by pyramid_tm/zope.sqlalchamy/transaction
transaction.manager
use_tweens
to True when using the invoke_subrequest
pyramid method
@dbyrns, @fmigneault I think I found it... when magpie used the I think using |
Oh, and by default |
So, setting pool_threadlocal to true isn't only pushing the limit ahead, it really removes the limit and we can do as many subrequest as required without exhausting the connections, right? |
Yes, by setting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
working on my side
I could reproduce the connection pool issues we were having, and this should fix it. I think multiple threads were getting the same session from the factory, and the sessions were then probably not closed properly.
Also, remove pool_threadlocal which is equivalent to use_threadlocal, which is deprecated.
Explanation here: https://docs.sqlalchemy.org/en/13/orm/contextual.html#thread-local-scope