Linux sockets problem (closed connections staying open?)

Linux sockets problem (closed connections staying open?)

Post by Scott M Bake » Sat, 02 May 1998 04:00:00



Hello,
        I'm devloping a Linux socket application and having some problems. I'd
appreciate any help that anyone could give on these issues:

1. I'm opening and closing TCP sockets at a high rate (500-1000
connections per second). Connections seem to be staying in CLOSE_WAIT
and TIMEOUT_WAIT state for a long time. I am using the following
(pseudo)code to close the socket:

        shutdown(socket,1)
        while (recv(socket,...)>0) ;
        close(socket)

I've also tried some code out of Apache web server that includes a
select() call in the recv() while loop to check for incoming data. No
difference.

2. Sometimes my program deadlocks, apparently inside of a socket call.
"ps -al" reports that it's stuck in tcp_getsocket. Netstat reports that
a large number of sockets are stuck in CLOSE_WAIT (or TIMEOUT_WAIT) and
they won't go away until I kill the process.

3. Most of the above problems start happening when I run the program at
near the limit of how many sockets it can process (and/or beyond what it
can handle)

4. Sometimes the client side of the connection gets a Connection_Refused
error. (This might be expected if the server is exceeding the listen
queue size)

I'm currently running under Red Hat 4.1. Will be upgrading to 5.0 in a
few weeks. The ethernet in use is 100mbs switched. I'd appreciate any

if possible.

--

 
 
 

1. Opening a socket connection while in a socket connection.

Hello,

I am new to using sockets and am working on a project that requires
me to audit services accessed under a client/server program (TCP/IP)
socket connection.

What I want to do is send a datapacket to a collector machine each
time a client accesses a service on the server.  It seems that
I am unable to do this from the server.  Basically, in short form
I need to be able to do the following:

1. Client connects (TCP/IP socket connection) to server
2. Client requests a service from the server
3. At that point I want to send a datapacket to a audit server.

Any Ideas?  I am familiar with most of the concepts involved in
using sockets.  Maybe I have been working on this to long and have
gotten tunnel vision.

Thanks

***********************************************************
Brent Curtiss


Academic Computing Services
The Ohio State University
***********************************************************

2. Penguin or VA Linux?

3. Closing sockets and closing connections

4. fdisk

5. Socket stays in CLOSE_WAIT after close()

6. Q: I have RTFM'd. Need help with Slirp over Ethernet. Thanks.

7. Problems with sockets - open() and close()

8. Environment variables for child process

9. Sockets problem (closing connections)

10. Socket Staying Open

11. Net connections staying open!

12. How to close OPENED unused sockets?

13. socket open/fopen 256 limit even after closing files.