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
In Ruby on Rails v5.2 and Puma v4, after restarting puma at the time of logrotate, unnecessary workers continue to remain #1891
Comments
Not a lot for us to go on or reproduce here. All I can say based on what you've provided is that we're working very actively on restart behavior lately, and to try 4.1 when it releases (very soon). We need some sort of script or simpler scenario that reproduces the issue you're seeing. Is the duplicated worker(s) always the last one (i.e., is it always worker #7, or sometimes #1 or #0?) |
Tagging @MSP-Greg here as well because he's been looking so much at restarts lately, wondering if this triggers any thoughts |
Too much. 'phased-restart' relies on the logic in |
I have confirmed that v4.1 has been released 🎉 I would like to use it with our service. |
Thank you for your explanation. Is there a way to properly stop unnecessary puma worker(s) generated using |
That's certainly how Puma should work.
Obviously, no one wants that happening. Speaking only for myself, am I 100% certain that this issue has been resolved in 4.1.0? No. Something similar to #1892 may be needed. In some respects, But, the code paths are not identical, and there may be cases where 'misbehaving' workers are not handled correctly. There's also the issue of when should a new worker be created. Should it be created when another worker is 'told to stop', or when the other worker has actually exited? Also, should the timers involved for 'external stop' versus 'phased-restart' be the same, or different? Sorry for the brief rant, but it is messy, and testing for it is also messy. If there are still issues remaining, they will get quickly fixed... |
Thank you for many replies. First, I report that the symptoms did not improve after updating to v4.1. Does "externally stopping" mean "send SIGUSR1 signal"? Both "phased-restart" and "send SIGUSR1 signal" are executed with logrotate, and the rotation interval is 1 hour. Is it possible to output a log of what each worker does when |
Closed by #1908. |
I will report. After puma v4.1.1 was released, I immediately updated to v4.1.1. After that, there was no situation where unnecessary workers remained for about a month. Thank you for your quick response and daily maintenance work. We will continue to use puma in the future. |
We are uses Ruby on Rails v5.2 and Puma v4, rotating the Rails application log with logrotate, and restarting puma when it is rotated.
We uses puma restart with
pumactl phased-restart
, but we used to send SIGUSR1 signal to restart it.Specifically, it is the following code.
Refs: https://github.com/puma/puma/blob/master/docs/restart.md
Although puma restarts without any problem for a while, after several restarts, unnecessary workers will be left as shown below. In the following, there are two worker 7s. Perhaps pid = 15241 seems to be an unnecessary worker.
My question is, I would like to know how to restart puma without leaving unnecessary workers.
Or I would like to know if there is a way to find out what each worker is doing to find out why this is the case.
Or, please tell me if there is a way to put in logs etc and check the situation after the fact.
The main usage version is as follows.
As mentioned above, puma restarts are performed by
pumactl phased-restart
, but the situation was the same by sending SIGUSR1 signal.The text was updated successfully, but these errors were encountered: