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
out_of_band hook not working when using multiple threads #2177
Comments
@GuiTeK Just curious, what do you use |
@nateberkopec I'd like to use it for Garbage Collection (to run |
I see. So, if we provide a feature in Puma, it should obviously work, and this definitely doesn't, so I want to fix that. However, OOBGC is an outdated technique since the changes introduced in the Ruby 2.3 GC. I can't recommend it. GitHub disabled it after they realized it was causing an additional 10% CPU usage. |
I contributed the PR #1648 that implemented the
My use-case for this feature has also been OOBGC, here are my previous comments on the topic #450 (comment):
|
That has got to be a weird workload indeed. I've rarely seen GC time >1% for apps I've worked on. I wonder if your workload is also part of the reason you see a lot of improvement on your dirty-fork PR. |
After looking at this more closely, it does look like the OOB hook never worked in any configuration with threads > 1. (It's been running in my production workload, but on a fork from which I've extracted various feature PRs, and I should have tested/verified the extracted out-of-band PR more thoroughly. Sorry!) I added my own attempt at a fix to #2218, which also includes a couple of tests. |
Closing in favor of #2218 |
Describe the bug
The
out_of_band
hook (C.F. #1648) seems not to work when the number of threads specified withthreads N, N
is> 1
.Puma config:
Command:
bundle exec puma -C config/puma.rb oob.ru
Contents of
oob.ru
:To Reproduce
config/puma.rb
andoob.ru
have the contents showed abovebundle exec puma -C config/puma.rb oob.ru
curl http://127.0.0.1:3000/
OOB Hook Working
does NOT get printed in Puma outputNow, to show it works with
threads 1, 1
:threads 2, 2
in the Puma config withthreads 1, 1
bundle exec puma -C config/puma.rb oob.ru
curl http://127.0.0.1:3000/
OOB Hook Working
IS present in Puma outputExpected behavior
I expect
out_of_band
hook to be called even when Puma is configured to run with multiple threads.Desktop:
The text was updated successfully, but these errors were encountered: