Re: Question
Posted in 1998
In article <35F842AB.41E3@bloomberg.net>, kagel@bloomberg.net (Art S. Kagel) wrote: > Jair Huerta wrote: > > > > Dear all: > > I want to know if is possible to take down TCP when you want > > to > > kill the sqlexec daemon, I mean if i want to kill the daemon and then > > put it to work again, is not possible > > because the bind address is already in use, because there are > > That bind address already in use is because the OS's TCP drivers have > not timed out the connections yet. There is a tunable or something to > tell the driver to not keep old connections alive (keepalive or some > such). Talk to your sysadmin or HP Tech support. This is a problem > with many UNIX's. > > Art S. Kagel > Sorry my mistake, its not the closure thats the problem but the incorrect rebinding to the port It's normal for connections to end up in FIN_WAIT_2 when the server is killed. (A good server catches termination signals and cleans up its connections, and a good sysadmin doesn't kill such a server with SIGKILL, so this problem shouldn't exist. But we can't count on such being the case.) According to the TCP/IP spec (ie. the dazzling panoply of RFCs, a connection in FIN_WAIT_2 that was owned by an application that's gone away will never transition to another state. However, many implementations terminate FIN_WAIT_2 connections that were fully closed locally after 10 minutes and 75 seconds, which is what you're seeing. A sockets-based TCP server should *always* set SO_REUSEADDR on the master socket before calling bind, so that it can bind again if there are residual connections in FIN_WAIT_2 or CLOSE_WAIT or whatever. This is probably one of two the most common TCP sockets programming errors. The other is setting SO_LINGER off, which you should never do. (If you know enough about what SO_LINGER does to contradict that statement, then you know about the extremely unusual architectures where disabling it makes sense.) Paul Watson # I don't suffer from WF Software Ltd. # stress, I'm just Tel. (+44) 1436 674729 # a carrier Fax. (+44) 1436 678693 # www.wfsoftware.co.uk