Re: socket closing

From: Mala Anand (manand@us.ibm.com)
Date: Tue Apr 24 2001 - 17:28:34 EST


< I have a server program that as far as I can tell correctly opens and
closes
 < sockets to clients.

< However, after a while, (A LONG TIME) my sockets build up and dont get
< closed. I have insrumented my code to make sure I am closing any file
< descriptor I receive over via accept.

< For the first 2 hours, when I do a socklist, I see just as many sockets
for
< my server program as there are clients

< After 2 hours or so though, the sockets keep building up and the file
< descriptors I get from accept kep increasing.

< My question is, how do I tell what these (UNCLOSED) file descriptors
point
< to ?

< I can so a stat on /proc/PID/fd/FILE and I get something like this:
< stat /proc/10881/fd/44
< File: "/proc/10881/fd/44" -> "socket:[1041079]"
< Size: 64 Blocks: 2 Symbolic Link
< Access: (0700/lrwx------) Uid: ( 501/ grao) Gid: ( 501/
< grao)
< Device: 4 Inode: 713130028 Links: 1
< Access: Tue Apr 24 12:10:20 2001
< Modify: Tue Apr 24 12:10:20 2001
< Change: Tue Apr 24 12:10:20 2001

< How do I get more info on that file descriptor so I can debug where I am
< going wrong?

      I am seeing similar problem using netpef3. After my client succefully
closes (300 connections) I still see 320 sockets in /proc/pid/fd directory.
When I list them they are shown as sockets (597 -> socket:[21780] ) but if
I do stat I get the following:

stat /proc/4776/fd/597
File: "/proc/4776/fd/597"
Size: 0 Filetype: Unknown
Mode: (0777/?rwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Device: 0,0 Inode:21780 Links: 1
Access: Tue Apr 24 14:00:20 2001
Modify: Tue Apr 24 14:00:20 2001
Change: Tue Apr 24 14:00:20 2001

If I kill my server these files go away. The server calls shutdown to
close both the data socket and control socket for each connection.

Regards,
    Mala

   Mala Anand
   E-mail:manand@us.ibm.com
   Linux Technology Center - Performance
   Phone:838-8088; Tie-line:678-8088

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org



This archive was generated by hypermail 2b29 : Mon Apr 30 2001 - 21:00:29 EST