gems/yabeda-puma-plugin-0.7.0/lib/puma/plugin/yabeda_prometheus.rb:74:in `block in start': undefined method `stop' for nil:NilClass (NoMethodError)
from gems/puma-5.6.5/lib/puma/events.rb:45:in `block in fire'
from gems/puma-5.6.5/lib/puma/events.rb:45:in `each'
from gems/puma-5.6.5/lib/puma/events.rb:45:in `fire'
from gems/puma-5.6.5/lib/puma/events.rb:156:in `fire_on_stopped!'
from gems/puma-5.6.5/lib/puma/launcher.rb:393:in `graceful_stop'
from gems/puma-5.6.5/lib/puma/launcher.rb:488:in `block in setup_signals'
...
events.on_stopped do
unless server&.shutting_down?
logger.log "* Stopping #{banner}"
server.stop(true)
end
end
It looks like that when the app is stopped before server got a chance to run, this exception may occur.
If the server is not shutting down, the block is executed, and server.stop(true) is called. When server is nil I can imagine this error occurs. Perhaps a check like if server && !server.shutting_down? would be more appropriate here.
Sometimes I'm getting this error:
Looking at the code it seems to me that a
&
is missing inyabeda_prometheus.rb
:It looks like that when the app is stopped before
server
got a chance to run, this exception may occur.If the server is not shutting down, the block is executed, and
server.stop(true)
is called. Whenserver
isnil
I can imagine this error occurs. Perhaps a check likeif server && !server.shutting_down?
would be more appropriate here.