Skip to content

reaper_status_logs = true causes before_worker_boot restart loop with Puma 7.x #111

Description

@obromios

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions