Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add DaemonAwareThreadPool for thread pools to block shutdown #10959

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 1 commit into from
Jun 5, 2024

Conversation

thrau
Copy link
Member

@thrau thrau commented Jun 4, 2024

Motivation

It's know that ThreadPoolsExecutors don't care about daemon threads. They add all their threads to a global list which is then iterated and joined on atexit. We have a patch in pro that adds this functionality, and we also added it a while back for hypercorn, which now lives in rolo.

This PR adds the functionality as a re-usable class, and uses it to implement the AdaptiveThreadPool, which is the thing being patched by pro. This allows us to get rid of the patch, which will help #10942.

Changes

  • THREAD_POOL will no longer join its threads on exit if the threads are daemon threads

@thrau thrau requested a review from dominikschubert June 4, 2024 19:01
@thrau thrau added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Jun 4, 2024
Copy link

github-actions bot commented Jun 4, 2024

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 39m 49s ⏱️ ±0s
3 007 tests ±0  2 684 ✅ ±0  323 💤 ±0  0 ❌ ±0 
3 009 runs  ±0  2 684 ✅ ±0  325 💤 ±0  0 ❌ ±0 

Results for commit 0b2f14f. ± Comparison against base commit fc00ea8.

@thrau thrau changed the title add DaemonawareThreadPool for thread pools to block shutdown add DaemonAwareThreadPool for thread pools to block shutdown Jun 4, 2024
Copy link
Member

@dominikschubert dominikschubert left a comment

Choose a reason for hiding this comment

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

Nice 👍 Makes a lot more sense to have this here

@thrau thrau merged commit 930aac6 into master Jun 5, 2024
38 of 39 checks passed
@thrau thrau deleted the patch-thread-pool branch June 5, 2024 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants