Environment
puma_worker_killer 1.0.0
puma 7.1.0
- Ruby 3.4.8
- Rails 8.0.3
- Heroku (Linux), 1 worker (
WEB_CONCURRENCY=1)
Steps to reproduce
Set config.reaper_status_logs = true in the PumaWorkerKiller.config block:
before_fork do
require 'puma_worker_killer'
PumaWorkerKiller.config do |config|
config.ram = 512
config.percent_usage = 0.9
config.frequency = 30
config.reaper_status_logs = true
end
PumaWorkerKiller.start
end
Expected behaviour
PumaWorkerKiller starts normally and monitors worker memory.
Actual behaviour
Puma logs the following warning on every worker boot and restarts workers
every ~30 seconds (matching config.frequency):
WARNING hook before_worker_boot failed with exception (NoMethodError)
undefined method 'call' for true
This occurs 100+ times per hour in production, causing continuous worker
churn and H12 request timeouts on every in-flight request at the moment
of each restart.
Root cause
reaper_status_logs = true appears to register a before_worker_boot
hook using an API that changed in Puma 7.x, resulting in the hook being
set to the boolean true rather than a callable. When Puma attempts to
invoke the hook it calls true.call, which raises NoMethodError.
Workaround
Remove config.reaper_status_logs = true from the config block.
Environment
puma_worker_killer1.0.0puma7.1.0WEB_CONCURRENCY=1)Steps to reproduce
Set
config.reaper_status_logs = truein thePumaWorkerKiller.configblock:Expected behaviour
PumaWorkerKiller starts normally and monitors worker memory.
Actual behaviour
Puma logs the following warning on every worker boot and restarts workers
every ~30 seconds (matching
config.frequency):This occurs 100+ times per hour in production, causing continuous worker
churn and H12 request timeouts on every in-flight request at the moment
of each restart.
Root cause
reaper_status_logs = trueappears to register abefore_worker_boothook using an API that changed in Puma 7.x, resulting in the hook being
set to the boolean
truerather than a callable. When Puma attempts toinvoke the hook it calls
true.call, which raisesNoMethodError.Workaround
Remove
config.reaper_status_logs = truefrom the config block.