Subject: Re: What does it mean when a TCP session is in state CLOSING?
To: Brian Buhrow <buhrow@cats.ucsc.edu>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 08/02/1998 11:12:04
On Sun, 2 Aug 1998 10:15:30 -0700 
 Brian Buhrow <buhrow@cats.ucsc.edu> wrote:

 > 	Hello.  I have a mail server machine which has been up 178 days
 > or so and which handles about 100,000 messages a day.  I just discovered a
 > number of TCP connections that seem to be permenantly in state CLOSING.
 > What is the definition of state CLOSING and what causes these connections
 > to get stuck forever?
 > 	This is running 1.2G sources of about September 1997.  Any 
 > explanations would be greatly appreciated.

This was due to the side-effect of a bug fix, which we have since
backed out and fixed ina different way.  (The "bug" was actually
mostly harmless; it merely bloated the packet count in simultaneous
close).  Here is a patch that should fix your problem.

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 940 5942

Index: tcp_fsm.h
===================================================================
RCS file: /cvsroot/src/sys/netinet/tcp_fsm.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -c -r1.9 -r1.10
*** tcp_fsm.h	1998/07/03 05:39:56	1.9
--- tcp_fsm.h	1998/07/09 05:49:56	1.10
***************
*** 1,4 ****
! /*	$NetBSD: tcp_fsm.h,v 1.9 1998/07/03 05:39:56 thorpej Exp $	*/
  
  /*
   * Copyright (c) 1982, 1986, 1993
--- 1,4 ----
! /*	$NetBSD: tcp_fsm.h,v 1.10 1998/07/09 05:49:56 mycroft Exp $	*/
  
  /*
   * Copyright (c) 1982, 1986, 1993
***************
*** 75,81 ****
  u_char	tcp_outflags[TCP_NSTATES] = {
      TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
      TH_ACK, TH_ACK,
!     TH_FIN|TH_ACK, TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
  };
  #endif
  
--- 75,81 ----
  u_char	tcp_outflags[TCP_NSTATES] = {
      TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
      TH_ACK, TH_ACK,
!     TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
  };
  #endif