Forum

configuration reload

Kyle Keen
21 October 2009, 03:52
I'm trying to add vhosts on the fly. As it stands, this involves building a new conf file, shutting down the server and finally restarting it.

Numerous problems with this, of course. Is there a better way?
Hugo Leisink
23 October 2009, 18:12
Hiawatha used to have configuration reload functionality, but it was removed due to stablility issues after reloading. A restart is the only sollution to activate a new configuration.
Kyle Keen
24 October 2009, 02:41
Bummer. I used to say that Hiawatha was 100% simple to work with. Guess that is down to 99%, and the honeymoon phase is over. But it is still my favorite web server by a long shot.

What exactly happens to active transfers and cgi processes when the server shut down? Who, if anyone, is going to notice the interruption?

Thanks for the feedback.

Hugo Leisink
24 October 2009, 13:09
Well, you have to understand that configuration reloading is not as simple as it may sound. What if the settings of a virtual host are changed and a client is still downloading from that virtual host? What if a virtual host is deleted? What if bindings are changed? If you want to do a solid reload, you have to disconnect all clients, flush the configuration, reload it and reopen ports. That's practicly the same as a restart.
Kyle Keen
24 October 2009, 14:04
I think I did not phrase my question plainly enough. I was not asking about hypotheticals or about the old reload code.

What happens (right now with the current version of Hiawatha) when you issue an "/etc/rc.d/hiawatha restart" command? My implementation has sends a "kill -15" immediately, and then a "kill -9" five seconds later. I've been building contrived experiments with slow wget connections, but I probably can't think of every possible combination.

Does it drop open connections immediately? Does it let open connections finish, but refuse new ones? Does it wait for cgi to finish? Does it kill cgi immediately? What if cgi is writing a file or talking to a database at the time?

Right now I am leaning towards hacking up the "/etc/rc.d/hiawatha" script, so the "kill -9" is sent first, followed by a tight while loop (instead of a sleep delay) followed by the start command. I know that generally "kill -9" is a bad thing, but what is the possible fallout from doing it to a webserver?
Hugo Leisink
24 October 2009, 14:48
If Hiawatha receives a TERM signal (15), it will close all connections: clients, CGI's and bindings, CGI's are not killed. They continue to run in the background. A 'kill -9' is not needed to shutdown Hiawatha.
Kyle Keen
24 October 2009, 15:34
The documentation just says "TERM Shutdown the webserver" which could have meant any of the above. Thank you for clearing that up.

That was actually the behavior I was hoping for, it makes everything much simpler. Though it might imply that a lucky script could run forever, since the server will not be able to enforce the time limit. Or does the list of active cgi PIDs carry over?

Hugo Leisink
24 October 2009, 17:09
CGI's that remain running are not carried over to a new instance of Hiawatha. They must be killed manually.
This topic has been closed.