I run several Perl dancer applications at the same time with the same user in FCGI mode (Apache). As I understand correctly, Apache (or any other webserver) will fork a new dancer application if the current one(s) are busy.
To ensure that no visitor is interrupted by the dancer shutdown I like to let dancer handles the current connection until it finished and then exit
/ last
the process.
How to shutdown a Perl dancer application using kill signal HUP
to perfom such nice shutdown?
To rollout a new version of a dancer application I use pkill -HUP perl
as the dancer user to "shutdown" the processes. But currently (due to missing signal handler) it's more like shoot 'em down as of shutdown an application .
The solution by mugen kenichi works ( starman
):
If you are able to change your infrastructure you could try one of the plack webservers that support your need. starman and hyponotoad both do graceful restarts on SIGHUP
There are a few shortcoming regarding <% request.uri_base %>
so we have to develop with hard coded URI paths. Not very handsome but necessary.
If I read your question correctly, you are concerned that Apache/FCGI might kill the Dancer app while it is in the middle of handling a request. Is that correct?
If so, don't worry about it. Apache/FCGI doesn't do that. When it forks a new instance of the handler because existing ones are busy, that's a new one in addition to the existing instances. The existing ones are left alone to finish what they're doing.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.