Skip to content

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