yabeda-puma-plugin
yabeda-puma-plugin copied to clipboard
Standalone exporter crashes puma on phased restart
Summary
When running in clustered mode with a standalone port for the Prometheus exporter, phased restarts cause the parent puma process to crash because a new server attempts to start without stopping the previous. Attempting to bind the port raises an error that unrolls the whole thing.
This is because the event/state handling of the embedded server instance doesn't catch the restarts properly. See yabeda_prometheus.rb.
Expected Behavior
- Application survives a phased restart
- Metrics are available before and after restart
Reproduction Steps
- Change to the spec/configs directory
- Add
plugin :yabeda_prometheusto puma.rb - Start app with
puma -C puma.rb lobster.ru - Send SIGUSR1 to the parent puma process (
kill -SIGUSR1 <pid>) - Observe crash:
Errno::EADDRINUSE: Address already in use - bind(2) for "0.0.0.0" port 9394