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

thread_pool: create a new thread group per process #577

Merged
merged 1 commit into from
Apr 22, 2020

Conversation

kyrylo
Copy link
Contributor

@kyrylo kyrylo commented Apr 22, 2020

Fixes #576 (ThreadError: can't move to the enclosed thread group)

When we Airbrake.notify inside a fork block, ThreadPool tries to respawn
workers (which were killed by the fork) to the same ThreadGroup, which was
created in the parent thread. The problem is that that ThreadGroup is already
finalised in that parent thread and no new threads can be added anymore. The
fix is to create a new ThreadGroup on fork. This way every process will have
its own ThreadGroup.

@kyrylo kyrylo force-pushed the 576-enclosed-thread-group-fix branch 2 times, most recently from b31d9e3 to 92f8ff9 Compare April 22, 2020 05:55
Fixes #576 (ThreadError: can't move to the enclosed thread group)

When we `Airbrake.notify` inside a `fork` block, `ThreadPool` tries to respawn
workers (which were killed by the `fork`) to the same `ThreadGroup`, which was
created in the parent process. The problem is that that `ThreadGroup` is already
finalised in that parent process and no new threads can be added anymore to the
group. The fix is to create a new `ThreadGroup` on `fork`. This way every
process will have its own `ThreadGroup`.
@kyrylo kyrylo force-pushed the 576-enclosed-thread-group-fix branch from 92f8ff9 to f9054be Compare April 22, 2020 06:00
@kyrylo kyrylo merged commit 965c49d into master Apr 22, 2020
@kyrylo kyrylo deleted the 576-enclosed-thread-group-fix branch April 22, 2020 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ThreadError: can't move to the enclosed thread group
1 participant