Subject: Hanging connections

From: Michael Assels <[email-masked]>
Date: Mon, 05 Jun 1995 09:44:45 -0400

Dear wu-ftpd experts,

I'm running wu-ftpd-2.4 on a Sparc 1+ (SunOS 4.1.3).  Ftpd is started
from inetd with the command line "ftpd -l -a".  Everything works
properly except that I regularly get connections that seem to hang forever
(at least for days) without being timed out.  This seems to happen with
about 3% of connections.

The hung connections appear in several different TCP states, most
commonly CLOSE_WAIT.  Quite often, netstat shows a socket in LISTEN
state, always corresponding to a zombie in the process table.

When I kill the hung processes, the zombies are cleaned up, the CLOSE_WAIT
connections move to LAST_ACK state, and the ESTABLISHED ones move to
FIN_WAIT_1.  The connections with zero 'Send-Q' values disappear from
netstat eventually, but the others stay on indefinitely.

I have to kill the processes every day or two, because I impose a limit
of ten external connections in ftpaccess.  If I don't clean up on time,
nobody will be able to get in.

Has anyone else seen this behaviour?  Is it related to wu-ftpd, or do I
have a deeper TCP problem? 

Sample ps and netstat ouput, with hostnames obfuscated, is appended.

Thanks for any input.

Michael

+-------------------------------+----------------------------------+
| Michael Assels, Analyst       | Everything is what it is and not |
| Comp. Sci., Concordia Univ.   | another thing.                   |
| 1455 de Maisonneuve O         |    - Aristotle (or someone else) |
| Montreal, Quebec, H3G 1M8     +----------------------------------+
| Voice: (514) 848-3030         |     [email-masked]     |
+-------------------------------+----------------------------------+

myname 7:04 / [101] # ps aux | grep ^ftp
ftp      15951  0.0  0.0    0    0 ?  Z    May  3  0:00 <defunct>
ftp      15561  0.0  0.0    0    0 ?  Z    May  3  0:00 <defunct>
ftp      15557  0.0  0.0  784    0 ?  IW   Jun  3  0:00 -a.x1.y1.z1
ftp      15950  0.0  0.0  784    0 ?  IW   Jun  3  0:00 -b.x2.y2.z2
ftp      21361  0.0  0.1  780   12 ?  S    06:40   0:00 -c.x3.y3.z3
ftp      18982  0.0  0.0  780    0 ?  IW   15:56   0:00 -d.x4.y4.z4
ftp      17580  0.0  0.0  780    0 ?  IW   07:43   0:00 -e.x5.y5.z5
ftp      17584  0.0  0.0  780    0 ?  IW   07:44   0:00 -e.x5.y5.z5
ftp      19150  0.0  0.0  780    0 ?  IW   17:04   0:00 -f.x6.y6.z6
ftp      15481  0.0  0.0  780    0 ?  IW   Jun  3  0:00 -g.x7.y7.z7

myname 7:04 / [102] # netstat -f inet
Active Internet connections
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp        0      0  myname.login           somewhere.1023         ESTABLISHED
tcp        0   3584  myname.ftp-data        c.x3.y3.z3.1493        ESTABLISHED
tcp        0      0  myname.ftp             c.x3.y3.z3.1492        ESTABLISHED
tcp        0   4096  myname.3450            f.x6.y6.z6.1495        CLOSE_WAIT
tcp        0      0  myname.ftp             f.x6.y6.z6.1494        CLOSE_WAIT
tcp        0   4096  myname.ftp-data        d.x4.y4.z4.1721        CLOSE_WAIT
tcp        0      0  myname.ftp             d.x4.y4.z4.1718        CLOSE_WAIT
tcp        0   3584  myname.3208            e.x5.y5.z5.1362        CLOSE_WAIT
tcp        0      0  myname.ftp             e.x5.y5.z5.1361        CLOSE_WAIT
tcp        0   4096  myname.3207            e.x5.y5.z5.1360        CLOSE_WAIT
tcp        0      0  myname.ftp             e.x5.y5.z5.1359        CLOSE_WAIT
tcp        0      0  myname.2914            *.*                    LISTEN
tcp        0      0  myname.ftp             b.x2.y2.z2.29249       CLOSE_WAIT
tcp        0      0  myname.2851            *.*                    LISTEN
tcp        0      0  myname.ftp             a.x1.y1.z1.1096        ESTABLISHED
tcp        0   4096  myname.ftp-data        g.x7.y7.z7.1456        CLOSE_WAIT
tcp        0      0  myname.ftp             g.x7.y7.z7.1455        CLOSE_WAIT
tcp        0   3472  myname.80              h.x8.y8.z8.1251        FIN_WAIT_1

myname 7:04 / [103] # kill 15557 15950 18982 17580 17584 19150 15481

myname 7:06 / [104] # netstat -f inet
Active Internet connections
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp        0   4096  myname.80              i.x9.y9.z9.3871        ESTABLISHED
tcp        0     80  myname.login           somewhere.1023         ESTABLISHED
tcp        0   3584  myname.ftp-data        c.x3.y3.z3.1493        ESTABLISHED
tcp        0      0  myname.ftp             c.x3.y3.z3.1492        ESTABLISHED
tcp        0   4096  myname.3450            f.x6.y6.z6.1495        LAST_ACK
tcp        0      0  myname.ftp             f.x6.y6.z6.1494        LAST_ACK
tcp        0   4096  myname.ftp-data        d.x4.y4.z4.1721        LAST_ACK
tcp        0      0  myname.ftp             d.x4.y4.z4.1718        LAST_ACK
tcp        0   3584  myname.3208            e.x5.y5.z5.1362        LAST_ACK
tcp        0      0  myname.ftp             e.x5.y5.z5.1361        LAST_ACK
tcp        0   4096  myname.3207            e.x5.y5.z5.1360        LAST_ACK
tcp        0      0  myname.ftp             e.x5.y5.z5.1359        LAST_ACK
tcp        0      0  myname.ftp             a.x1.y1.z1.1096        FIN_WAIT_1
tcp        0   4096  myname.ftp-data        g.x7.y7.z7.1456        LAST_ACK
tcp        0      0  myname.ftp             g.x7.y7.z7.1455        LAST_ACK
tcp        0   3472  myname.80              h.x8.y8.z8.1251        FIN_WAIT_1

myname 7:06 / [105] # ps aux | grep ^ftp
ftp      21361  0.0  0.3  780   36 ?  S    06:40   0:00 -c.x3.y3.z3

---

From: [email-masked] (ssh)
Date: Mon, 5 Jun 1995 12:15:16 -0400 (EDT)

> (at least for days) without being timed out.  This seems to happen with

you can set the timeouts with the -t<timeout in seconds> and the -T<maximum
timeout in seconds> flags, just add them to the -l, -a flags in inetd.conf.

i have mine set to -t300 and -T1800

that would most likely help.