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

Don't use a ThreadGroup for tracking worker threads #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bpot
Copy link

@bpot bpot commented Jan 7, 2011

Mongrel current uses a ThreadGroup to track its worker threads. But this has the unintended side-effect that any thread spawned by a request will inherit the group of the request thread. Thus, mongrel will think these new threads are requests and take them into account when it enforces num_process restrictions. This mostly went unnoticed for us in 1.1.3 but after upgrading 1.1.5 the num_process enforcement fix caused mongrels to start rejecting requests after we spawned a background thread pool.

I've fixed this by tracking threads in an array and then purging any completed threads whenever this array is accessed. This is not ideal, but I think any other fix would require the thread removing itself from the list of workers and thus require a mutex. Using an array seemed like the most straight-forward fix.

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.

1 participant