Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#22910 - [nginx] rc script restart is too fast
Attached to Project:
Community Packages
Opened by Thomas S Hatch (thatch45) - Wednesday, 16 February 2011, 00:12 GMT
Last edited by Sergej Pupykin (sergej) - Tuesday, 12 July 2011, 14:05 GMT
Opened by Thomas S Hatch (thatch45) - Wednesday, 16 February 2011, 00:12 GMT
Last edited by Sergej Pupykin (sergej) - Tuesday, 12 July 2011, 14:05 GMT
|
DetailsOften when calling /etc/rc.d/nginx restart the start occurs before the stop is finished, the sleep should be closer to 5-10, or the restart should watch for the process to die and then start it up (maybe watch the pid with a timeout)
|
This task depends upon
Right now I see a number of cases, one is that if the service itself can be sent a quit command that blocks until the service has cleaned itself up properly then that is optimal, like in the moosefs rc scripts: http://projects.archlinux.org/svntogit/community.git/tree/mfs/trunk/mfsmaster
But in cases where this is not an option we should devise something more elegant than a sleep. I would propose a simple solution, we add a restart function to the /etc/rc.d/functions file that takes a PID as an arg, and then watches the pid for a configurable amount of time. Then if the timeout is reached the function can either send a SIGKILL to the process or just stat fail.
Actually, now that I am typing all of this out, it sounds to me a lot more like redhat's killproc function. Something that makes the kill just block until the process is ensured dead. But I think that we need a timeout and a decision.
If I am not mistaken, redhat will just block, for a very long time, I have seen redhat block for over 10 minutes when stopping a service. Ubuntu has a short timeout and then instead of stating a failure it sends a SIGKILL and destroys the service that way. The Ubuntu way has bitten me quite a few times and I would stongly discourage it - but I think that it should be an option for the developer of the rc script, since some processes can be safely sent a SIGKILL (I have seen dnsmasq for instance not die with a SIGTERM but it can be safely killed with a SIGKILL)
So in a nutshell, I think that we should provide a function in /etc/rc.d/functions for killing a process, and that the function will take 3 args, 1 required arg - The process PID, and then the 2 remaining args would be the timeout, (default to say 10 seconds), and then what to do if the timeout is reached, default to a stat fail and have the option to send the PID a SIGKILL.
I think that this would greatly benefit Arch rc scripts, I have run into this problem with a number of rc scripts when using automation tools like puppet and when using automation scripts.
If it is something that could be included in the functions file, then I will write up the function, just let me know.
But there are a number of other rc scripts that have this problem, do you think that the solution I mentioned is potentially viable? Should I spend the time on it?
I will have a solution for this problem soon, thanks.
Should this bug be assigned to me? as lowly TU, can I assign bugs?
https://bugs.archlinux.org/task/22946
Or at least something allong those lines would be an elegant solution