Skip to content
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

Switch drain_all call to be called from new thread instead of event loop. #16739

Conversation

jeanluciano
Copy link
Contributor

@jeanluciano jeanluciano commented Jan 15, 2025

Moves the drain_all call to a new thread instead of the event loop.

closes: #16115

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

Copy link

codspeed-hq bot commented Jan 15, 2025

CodSpeed Performance Report

Merging #16739 will not alter performance

Comparing jean/oss-5963-deadlock-when-deloying-flow-with-dependencies-that (ca4b321) with main (5b5043c)

Summary

✅ 2 untouched benchmarks

Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm i think it might be good to add a unit or integration test for this one! i remember some weird shutdown / deadlock here

@github-actions github-actions bot added the bug Something isn't working label Jan 16, 2025
@jeanluciano jeanluciano marked this pull request as ready for review January 16, 2025 19:51
Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still seem to remember some issue about spawning a new thread at interpreter shutdown a la python/cpython#116677 but maybe this has since been fixed and released in a recent version of python 3.12 cc @jlowin (I remember we both ran into this)

anyways if we're passing tests and not seeing any issues, I think this makes sense

@@ -118,7 +118,7 @@ def flush(cls) -> None:

# Not ideal, but this method is called by the stdlib and cannot return a
# coroutine so we just schedule the drain in the global loop thread and continue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment should probably be updated to match new behavior

Suggested change
# coroutine so we just schedule the drain in the global loop thread and continue
# coroutine so we just schedule the drain in a new thread and continue

logger = logging.getLogger(__name__)
logger.setLevel("WARNING")

dictConfig({"version": 1, "incremental": False})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the bug ticket says the bug is triggered with incremental=True?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my mistake, it is incremental=False as that is what makes configure call _clearExistingHandlers

@jeanluciano jeanluciano merged commit c5d1b99 into main Jan 17, 2025
45 checks passed
@jeanluciano jeanluciano deleted the jean/oss-5963-deadlock-when-deloying-flow-with-dependencies-that branch January 17, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deadlock when deloying flow with dependencies that reconfigure the python logger
3 participants