-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Make LocalExecutor work under heavy load #47678
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kaxil
approved these changes
Mar 12, 2025
jedcunningham
approved these changes
Mar 12, 2025
Member
jedcunningham
left a comment
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.
(phew)
ashb
commented
Mar 12, 2025
ashb
commented
Mar 12, 2025
Member
Author
|
TaskSDK tests are failing in task sdk. Fix is here #47679 |
2783431 to
ea66c92
Compare
This change seems innocuous, and possibly even wrong, but it is the correct behaviour since #47320 landed. We _do not_ want to call dispose_orm, as that ends up reconnecting, and sometimes this results in the wrong connection being shared between the parent and the child. I don't love the "sometimes" nature of this bug, but the fix seems sound. Prior to this running one or two runs concurrently would result in the scheduler handing (stuck in SQLA code trying to roll back) or an error from psycopg about "error with status PGRES_TUPLES_OK and no message from the libpq". With this change we were able to repeatedly run 10 runs concurrently. The reason we don't want this is that we registered an at_fork handler already that closes/discards the socket object (without closing the DB level session) so calling dispose can, perversely, resurrect that object and try reusing it! Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Co-authored-by: Kaxil Naik <kaxilnaik@apache.org>
ea66c92 to
c48f02a
Compare
Member
|
Merging. Failure is unrelated. |
nailo2c
pushed a commit
to nailo2c/airflow
that referenced
this pull request
Apr 4, 2025
This change seems innocuous, and possibly even wrong, but it is the correct behaviour since apache#47320 landed. We _do not_ want to call dispose_orm, as that ends up reconnecting, and sometimes this results in the wrong connection being shared between the parent and the child. I don't love the "sometimes" nature of this bug, but the fix seems sound. Prior to this running one or two runs concurrently would result in the scheduler handing (stuck in SQLA code trying to roll back) or an error from psycopg about "error with status PGRES_TUPLES_OK and no message from the libpq". With this change we were able to repeatedly run 10 runs concurrently. The reason we don't want this is that we registered an at_fork handler already that closes/discards the socket object (without closing the DB level session) so calling dispose can, perversely, resurrect that object and try reusing it! Co-authored-by: Jed Cunningham <66968678+jedcunningham@users.noreply.github.com> Co-authored-by: Kaxil Naik <kaxilnaik@apache.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area:Executors-core
LocalExecutor & SequentialExecutor
area:Scheduler
including HA (high availability) scheduler
area:task-sdk
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change seems innocuous, and possibly even wrong, but it is the correct
behaviour since #47320 landed. We do not want to call dispose_orm, as that
ends up reconnecting, and sometimes this results in the wrong connection
being shared between the parent and the child. I don't love the "sometimes"
nature of this bug, but the fix seems sound.
Prior to this running one or two runs concurrently would result in the
scheduler handing (stuck in SQLA code trying to roll back) or an error from
psycopg about "error with status PGRES_TUPLES_OK and no message from the libpq".
With this change we were able to repeatedly run 10 runs concurrently.
The reason we don't want this is that we registered an at_fork handler already
that closes/discards the socket object (without closing the DB level session)
so calling dispose can, perversely, resurrect that object and try reusing it!
Co-authored-by: Jed Cunningham 66968678+jedcunningham@users.noreply.github.com
Co-authored-by: Kaxil Naik kaxilnaik@apache.org
^ 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.rstor{issue_number}.significant.rst, in newsfragments.