-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Slow transactions in requests made with OAuth2 tokens hold open per-request row exclusive locks #4694
Comments
It looks like this code is responsible for obtaining the row lock at the top of the transaction: https://github.com/ansible/awx/blob/devel/awx/main/models/oauth.py#L122-L124 /venv/awx/lib64/python3.6/site-packages/django/core/handlers/base.py(113)_get_response()
/usr/lib64/python3.6/contextlib.py(52)inner()
/venv/awx/lib64/python3.6/site-packages/django/views/decorators/csrf.py(54)wrapped_view()
/venv/awx/lib64/python3.6/site-packages/django/views/generic/base.py(71)view()
/awx_devel/awx/api/generics.py(294)dispatch()
/venv/awx/lib64/python3.6/site-packages/rest_framework/views.py(478)dispatch()
/awx_devel/awx/api/generics.py(170)initialize_request()
/venv/awx/lib64/python3.6/site-packages/rest_framework/request.py(223)user()
/venv/awx/lib64/python3.6/site-packages/rest_framework/request.py(376)_authenticate()
/awx_devel/awx
/api/authentication.py(46)authenticate()
/venv/awx/lib64/python3.6/site-packages/oauth2_provider/contrib/rest_framework/authentication.py(29)authenticate()
/venv/awx/lib64/python3.6/site-packages/oauth2_provider/oauth2_backends.py(169)verify_request()
/venv/awx/lib64/python3.6/site-packages/oauthlib/oauth2/rfc6749/endpoints/base.py(87)wrapper()
/venv/awx/lib64/python3.6/site-packages/oauthlib/oauth2/rfc6749/endpoints/resource.py(75)verify_request()
/venv/awx/lib64/python3.6/site-packages/oauthlib/oauth2/rfc6749/tokens.py(351)validate_request()
/venv/awx/lib64/python3.6/site-packages/oauth2_provider/oauth2_validators.py(377)validate_bearer_token()
> /awx_devel/awx/main/models/oauth.py(124)is_valid() |
this avoids acquiring a row lock (and holding it for the duration of transactions that include a very slow query) see: ansible#4694
this avoids acquiring a row lock (and holding it for the duration of transactions that include a very slow query) see: ansible#4694
this avoids acquiring a row lock (and holding it for the duration of transactions that include a very slow query) see: ansible#4694
@ryanpetrello please help me with this this looks horrible |
😂 let's chat about it |
😄 Ok it was not that horrible :) I make a token and applied the suggested diff to make GET to /api very slow Using the same token in two windows, while
hung for a long time (by design), I still got very snappy response from
in a different terminal (same host, same token). Additionally, while the slow request was running, I did not see the
Going to touch base with you, but I think this is good to be closed. Thanks! |
Yep, this looks good @kdelee! |
sounds good, thanks! |
ISSUE TYPE
SUMMARY
/api/
very slow:Observe the second request does not complete until the first request completes.
The text was updated successfully, but these errors were encountered: