Re: Problems with server shutdown
- From: phil-news-nospam@xxxxxxxx
- Date: 27 Oct 2006 22:15:01 GMT
On 27 Oct 2006 06:38:34 -0700 John Smith <SMasiutin@xxxxxxxxx> wrote:
| I have TCP server that accepts client and then receives data from them.
| Server has SIGTERM handler, on which all sockets are closed and server
| exits.
| If server has several clients connected and I manually send it kill
| -TERM <server_pid> everything goes correct: client application's
| sockets are disconnected and server shuts down the right way. But if I
| reboot machine some strange behavior occur: client application's
| sockets still think they are connected, and after server receives
| SIGTERM all semaphores that were in blocked state become unblocked.
| Can someone explain me what's going on?
Your system shutdown script are disabling network interfaces before the
final termination is done. You need to write an init script for your
server (daemon) that performs the server process shutdown in designated
shutdown order instead of waiting for the final SIGTERM that cleans out
the rest. All network daemons need to do this. The most common means
is for the daemon (your server program) to write its process ID number
to a file, when started, for the script to read when it's time to shut
it down. Than the script can set it a specific SIGTERM or whatever other
signal you might want to do for a more graceful shutdown.
--
|---------------------------------------/----------------------------------|
| Phil Howard KA9WGN (ka9wgn.ham.org) / Do not send to the address below |
| first name lower case at ipal.net / spamtrap-2006-10-27-1711@xxxxxxxx |
|------------------------------------/-------------------------------------|
.
- References:
- Problems with server shutdown
- From: John Smith
- Problems with server shutdown
- Prev by Date: Re: System calls parameter restrictions
- Next by Date: Re: System calls parameter restrictions
- Previous by thread: Problems with server shutdown
- Index(es):
Relevant Pages
|