Re: Problems with server shutdown



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 |
|------------------------------------/-------------------------------------|
.



Relevant Pages

  • Re: Banana Republic (was Re: OpenVMS Book Wins award)
    ... client ... No bollocks HTTP, SOAP, XML, Java, Garbage ... receive messages from any number of server processes who in turn could be ... Unlike TCP/IP and/or UDP Sockets with Java that have been around since ...
    (comp.os.vms)
  • Re: Asynchronous socket programming vs. remoting
    ... You are the first person that said I should use sockets. ... them quicker than I can load them from my harddrive using the file system. ... It scales nice too - I tried throwing 400 requests at the server in a span ... > do not need the same assembly on the client and server. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Emulating I/O Completion Port on Win98.
    ... or for GUI programs - use async I/O ... > My Client is an FTP Client and I thought emulating IOCP would be the best ... > solution under Win98 to quickly copy a big file from the FTP Server. ... >>> monitor thread created dedicates to check the IO status of the sockets ...
    (microsoft.public.win32.programmer.networks)
  • Re: Emulating I/O Completion Port on Win98.
    ... server, not client? ... If you client behave as a server to other client you do can use IOCP too, ... > 1) How many sockets should be in the list? ...
    (microsoft.public.win32.programmer.networks)
  • Re: another sockets library
    ... Currently it is C, only, but platform independant (works on Windows, Mac ... There is a server and client example. ... I've seen this remark about Windows sockets and selecta few times ...
    (comp.lang.lisp)