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

fix: Avoid crashing if not in cluster mode #103

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jcw-
Copy link

@jcw- jcw- commented Oct 14, 2022

If PumaWorkerKiller is enabled, but Puma isn't in cluster mode (no workers), after roughly six hours, it crashes:

#<Thread:0x00007fdcbc998ef0 /Users/jcw/.rvm/gems/ruby-2.7.6/gems/puma_worker_killer-0.3.1/lib/puma_worker_killer/auto_reap.rb:14 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	4: from /Users/jcw/.rvm/gems/ruby-2.7.6/gems/puma_worker_killer-0.3.1/lib/puma_worker_killer/auto_reap.rb:17:in `block in start'
	3: from /Users/jcw/.rvm/gems/ruby-2.7.6/gems/puma_worker_killer-0.3.1/lib/puma_worker_killer/rolling_restart.rb:17:in `reap'
	2: from /Users/jcw/.rvm/gems/ruby-2.7.6/gems/puma_worker_killer-0.3.1/lib/puma_worker_killer/rolling_restart.rb:12:in `get_total_memory'
	1: from /Users/jcw/.rvm/gems/ruby-2.7.6/gems/puma_worker_killer-0.3.1/lib/puma_worker_killer/puma_memory.rb:53:in `get_total'
/Users/jcw/.rvm/gems/ruby-2.7.6/gems/puma_worker_killer-0.3.1/lib/puma_worker_killer/puma_memory.rb:75:in `set_workers': undefined method `each' for nil:NilClass (NoMethodError)

While it's true that this plugin doesn't make sense to run unless there's workers to monitor, in case someone does, this PR fixes the crash.

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.

None yet

1 participant