[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

TCP connections



    Date: Mon, 2 Mar 1992 14:34 EST
    From: klehr@sunspot.ece.clarkson.edu (Thomas J. Klehr)

    I find that running our Symbolics 3670 with Genera 8.0 for an extended
    period of time without warm-booting it causes a buildup of TCP
    connections; these are shown in Peek.  Is there a patch to get rid of
    old connections that are no longer in use?

Are most of them TCP-FTP connections in CLOSED state?  I've noticed this
problem for a couple of years, but only bothered investigating it last
year.

The following should get rid of any closed connections that are still in
the display:

(mapc #'tcp::remove-tcb
      (remove :closed tcp::*tcb-list*
	      :key #'tcp::tcb-state :test-not #'eq))

Here's the message I sent to Symbolics about the problem.  Warning about
the patch I included: I tried it out when I sent the message, but I
never actually installed it, so it hasn't had extensive testing.  We
don't make much use of FTP (we mostly use NFS), so the bug isn't a
serious problem for us.  Note also that the patch is for the 8.1 system;
I don't know offhand whether the 8.0 version of this method is the same.
The change is simple, though, and highlighted in uppercase.

Date: Thu, 29 Aug 1991 18:03-0400
Subject: TCP-FTP connection not closed

In Symbolics 3645 Genera 8.1, IP-TCP 435.2, ...
world booted from FEP0:>starlisp-6-1-v21.load.1 on Symbolics 3645 #5576
(Occam):

There seem to be some paths through TCP and TCP-FTP that can cause TCP
connections to be left around when they should have become garbage.
This message reports the TCP-FTP problem, and I'll report the others in
separate messages.

I used TCP-FTP to read a file on a Unix file server.  Then I kill the
FTP server process, so it closes the connection.  This caused the TCP
connection to go to the CLOSE-WAIT state.  Shortly thereafter the file
connection scavenger deleted the TCP-FTP-CONN from the file access
path's CONNS list; however, the TCP stream was never closed, so the
connection is still listed by Peek Network.  I believe the problem is in
the second loop in (FLAVOR:METHOD :SCAVENGE
FS:TCP-FTP-FILE-ACCESS-PATH).  When FTP-CONNECTED-P returns NIL, the
connection is deleted from the CONNS list, but it is never reset.
FTP-CONNECTED-P returns NIL for a connection in CLOSE-WAIT state.

Here's a patch that seems to fix this problem:
(defmethod (:scavenge tcp-ftp-file-access-path) ()
  (if conns
      (let ((scavenge-time (send self :control-connection-lifetime)))
	(when scavenge-time
	  (dolist (conn conns)
	    (send conn :scavenge scavenge-time)))
	(process:with-no-other-processes
	  (unless
	    (loop for conn in conns
		  with conns-remaining = nil
		  when (ftp-connected-p conn)
		    do (setq conns-remaining t)
		  else do (SEND CONN :RESET)	;IN CASE IT'S ONLY HALF-CLOSED
			  (setq conns (delete conn conns))
		  finally (return conns-remaining))
	    (send self :reset))
	  t))
   nil))