From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20267 invoked by alias); 15 Jun 2005 22:39:11 -0000 Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Received: (qmail 19963 invoked by uid 22791); 15 Jun 2005 22:39:05 -0000 Received: from snvl-smtp1.trimble.com (HELO snvl-smtp1.trimble.com) (63.251.235.20) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 15 Jun 2005 22:39:05 +0000 Received: (qmail 22237 invoked by uid 501); 15 Jun 2005 15:37:07 -0700 Received: from 10.1.184.32 by snvl-smtp1.trimble.com (envelope-from , uid 107) with qmail-scanner-1.24 (clamdscan: 0.85.1/941. trophie: 7.510-1002/689/103395. spamassassin: 3.0.3. Clear:RC:1(10.1.184.32):. Processed in 0.023206 secs); 15 Jun 2005 22:37:07 -0000 Received: from unknown (HELO uss-am-xch-02.am.trimblecorp.net) (10.1.184.32) by snvl-smtp1.trimble.com with SMTP; 15 Jun 2005 15:37:07 -0700 Received: from uss-am-xch-03.am.trimblecorp.net ([10.1.137.33]) by uss-am-xch-02.am.trimblecorp.net with Microsoft SMTPSVC(5.0.2195.6713); Wed, 15 Jun 2005 15:37:08 -0700 Received: from 10.1.150.165 ([10.1.150.165]) by uss-am-xch-03.am.trimblecorp.net ([10.1.137.33]) via Exchange Front-End Server usd-am-web-01.am.trimblecorp.net ([10.1.1.144]) with Microsoft Exchange Server HTTP-DAV ; Wed, 15 Jun 2005 22:37:08 +0000 Received: from wlentz by usd-am-web-01.am.trimblecorp.net; 15 Jun 2005 15:37:06 -0700 From: Will Lentz To: ecos-discuss@ecos.sourceware.org Cc: Will Lentz Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Wed, 15 Jun 2005 22:39:00 -0000 Message-Id: <1118875026.9020.21.camel@localhost.localdomain> Mime-Version: 1.0 Subject: [ECOS] uipc_socket.c X-SW-Source: 2005-06/txt/msg00112.txt.bz2 Hi, I may have found a potential bug in packages/net/bsd_tcpip/current/src/sys/kern/uipc_socket.c (or I may be completely wrong :-). At the end of sodealloc(), the following code exists: zfreei(so->so_zone, so); wakeup(so->so_zone); The problem is that zfreei() changes so->so_zone. Shouldn't wakeup() be done on the original so->so_zone? I only noticed this problem by: 1- while(1) { sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP ); connect( sock, ... ); close( sock ); } Eventually this pauses in socket() (in cyg_tsleep()) when you run out of eCos sockets. 2- After 2*MSL or so, cyg_wakeup() gets called with chan == 0x0. Why? The zfreei() call in sodealloc() changes so->so_zone to 0 before the wakeup() call. The following diff solves the problem for me by making the wakeup() work on the so_zone that was freed: --- uipc_socket.c Thu Jul 24 11:04:25 2003 +++ new_uipc_socket.c Wed Jun 15 14:54:20 2005 @@ -202,8 +202,12 @@ FREE(so->so_accf, M_ACCF); } #endif /* INET */ - zfreei(so->so_zone, so); - wakeup(so->so_zone); + { + struct vm_zone *tmp = so->so_zone; + + zfreei(so->so_zone, so); + wakeup(tmp); + } } Any ideas? Suggestions? Thanks, Will -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss