-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: added scoped session for SQL-based alerting #10531
Conversation
FYI @john-bodley , interesting empirical observations for when scoped sessions can be helpful. This might explain the presence of some of the scoped sessions that were removed in #10427 |
@JasonD28 Did this change solve the errors completely? |
I'm trying to determine what the effect of scoped sessions vs vanilla sessions is. Did you try with scoped sessions without the retry, did that improve reliability? |
scoped sessions without retry did improve reliability with the exception of #10530 for reference, before adding scoped sessions |
@JasonD28 thanks for the context, really helpful! 👍 |
@villebro thanks for being looped in. I do wonder if the scoped session is merely masking some other issue we haven’t addresses, i.e., it seems somewhat nonintuitive that a scoped session is necessary here. |
@villebro @john-bodley further testing showed that just implementing retrying was sufficient enough for the celery task to run without any errors. While non-scoped sessions invoked retrying more often than scoped sessions, I'm going to close this PR and move forward with non-scoped sessions #10542 until more information is know about whats causing the error. |
SUMMARY
Multiple errors such as
sqlalchemy.exc.NoSuchColumnError
,sqlalchemy.exc.ResourceClosedError
andMySQLdb._exceptions.OperationalError
were being seen when multiple alert celery tasks were run concurrently. These errors occurred during the first few iterations of a celery beat schedule after initialization, however they would stop after after a few iterations of the beat schedule. This PR usesdb.create_scoped_session()
for alerting celery tasks to fix these errors. Retrying is implemented along with the celery task as a temporary fix for #10530BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION