From owner-freebsd-bugs Thu Dec 30 7:40: 5 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id A71B015319 for ; Thu, 30 Dec 1999 07:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id HAA33352; Thu, 30 Dec 1999 07:40:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 5B94E14D65; Thu, 30 Dec 1999 07:38:07 -0800 (PST) Message-Id: <19991230153807.5B94E14D65@hub.freebsd.org> Date: Thu, 30 Dec 1999 07:38:07 -0800 (PST) From: pfritz@nap.com.ar To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: kern/15783: tcp connections linger too long in the timed wait state Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 15783 >Category: kern >Synopsis: tcp connections linger too long in the timed wait state >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Dec 30 07:40:02 PST 1999 >Closed-Date: >Last-Modified: >Originator: Pablo J. Fritz >Release: 3.3-RELEASE >Organization: Network Access Point S.R.L. >Environment: not available at this moment, sorry >Description: While stress-testing Apache on FreeBSD, we found an out of memory condition. We found that tcp streams are kept in the last stage (the timed wait) for 60 seconds, while the specs say that this state has to last 2 round-trip times. So, if you open and close enough connections per second, you can waste all memory and halt the service. This error was also present in OpenBSD and NetBSD, but they crashed to the kernel when out of memory, while FreeBSD only didn't let more connections to be created until the others timed out. >How-To-Repeat: open a connection to the web server, close it, and look at how many seconds it takes to destroy the endpoint and release the memory. I used netstat -m. >Fix: I could alleviate the problem changing the timeout form 60 seconds to 6 seconds, but what should be done is the rewriting of the tcp state machine. I changed in /usr/src/sys/netinet/tcp_timer.h the value of TCPTV_MSL from 30 seconds to 3 seconds, and rebuilt the kernel. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message