-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
Fix flaky sqlite tests with test_xcom_map_nest
hopefully
#33145
Conversation
Recently sqlite started to fail randomly during teardown of `test_xcom_map_nest` or `test_xcom_map_zip_nest`. This happpened after adding `test_xcom_map_zip_nest` . It looked very strange: ``` sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread ``` By analysing possible reasons it seems that it was a side effect of the existing `test_xcom_map_nest` that allocated a new session in the run method of task instance rather than pass the sesion that is created and torrn down in the pytest fixture. The hypothesis is that the session created in the ``test_xcom_map_nest`` were being reclaimed and closed while the `test_xcom_map_zip_nest` test was already starting in a different thread started by Pytest. The fix is to pass the session object to run method of the taskinstance in the ``test_xcom_map_nest`` test.
Hey @uranusjr -> I think I found the reason of the |
Example flaky tests:
|
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.
Nice catch!
Yeah.... Let's see if it helps, but looks plausible. |
Also add it to 2.7.0 in the hopes it will stabilize the tests there. |
Similarly to apache#33145 - this is an attempt to stabilise flaky tests for the test_xcom_arg_map. Even if the mechanism is not entirely clear (provide_session should also close the connection) seems like using pytest-fixture provided session works better than relying on a new session created in run() methods.
Similarly to #33145 - this is an attempt to stabilise flaky tests for the test_xcom_arg_map. Even if the mechanism is not entirely clear (provide_session should also close the connection) seems like using pytest-fixture provided session works better than relying on a new session created in run() methods.
Similarly to #33145 - this is an attempt to stabilise flaky tests for the test_xcom_arg_map. Even if the mechanism is not entirely clear (provide_session should also close the connection) seems like using pytest-fixture provided session works better than relying on a new session created in run() methods. (cherry picked from commit 3dd0c99)
Recently sqlite started to fail randomly during teardown of `test_xcom_map_nest` or `test_xcom_map_zip_nest`. This happpened after adding `test_xcom_map_zip_nest` . It looked very strange: ``` sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread ``` By analysing possible reasons it seems that it was a side effect of the existing `test_xcom_map_nest` that allocated a new session in the run method of task instance rather than pass the sesion that is created and torrn down in the pytest fixture. The hypothesis is that the session created in the ``test_xcom_map_nest`` were being reclaimed and closed while the `test_xcom_map_zip_nest` test was already starting in a different thread started by Pytest. The fix is to pass the session object to run method of the taskinstance in the ``test_xcom_map_nest`` test. (cherry picked from commit d1d6fc9)
Recently sqlite started to fail randomly during teardown of
test_xcom_map_nest
ortest_xcom_map_zip_nest
.It looks very strange:
By analysing possible reasons it seems that it was a side effect of the existing
test_xcom_map_nest
that allocated a new session in the run method of task instance rather than pass the sesion that is created and torrn down in the pytest fixture.The hypothesis is that the session created in the
test_xcom_map_nest
were being reclaimed and closed while thetest_xcom_map_zip_nest
test was already starting in a different thread started by Pytest.The fix is to pass the session object to run method of the taskinstance in the
test_xcom_map_nest
test.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.