From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31060 invoked by alias); 17 Jun 2005 21:00:12 -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 31042 invoked by uid 22791); 17 Jun 2005 21:00:06 -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; Fri, 17 Jun 2005 21:00:06 +0000 Received: (qmail 23812 invoked by uid 501); 17 Jun 2005 14:00:02 -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/944. trophie: 7.510-1002/693/103446. spamassassin: 3.0.3. Clear:RC:1(10.1.184.32):. Processed in 0.017069 secs); 17 Jun 2005 21:00:02 -0000 Received: from unknown (HELO uss-am-xch-02.am.trimblecorp.net) (10.1.184.32) by snvl-smtp1.trimble.com with SMTP; 17 Jun 2005 14:00:01 -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); Fri, 17 Jun 2005 13:59:57 -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 ; Fri, 17 Jun 2005 20:59:57 +0000 Received: from wlentz by usd-am-web-01.am.trimblecorp.net; 17 Jun 2005 13:59:55 -0700 From: Will Lentz To: Andrew Lunn Cc: Hans H?bner , ecos In-Reply-To: <20050617200916.GB17597@lunn.ch> References: <1118875026.9020.21.camel@localhost.localdomain> <20050616083626.U69813@web.m68k.de> <20050617200916.GB17597@lunn.ch> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 17 Jun 2005 21:00:00 -0000 Message-Id: <1119041995.32361.0.camel@localhost.localdomain> Mime-Version: 1.0 Subject: Re: [ECOS] uipc_socket.c (and cyg_tcp_maxidle) X-SW-Source: 2005-06/txt/msg00151.txt.bz2 Thanks! That works great :-) On Fri, 2005-06-17 at 22:09 +0200, Andrew Lunn wrote: > On Thu, Jun 16, 2005 at 09:01:23AM +0200, Hans H?bner wrote: > > On Wed, 15 Jun 2005, Will Lentz wrote: > > > > >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. > > This is not quite correct. zfreei() does not change so->so_zone. What > it does is return the memory for the so structure to the pool. The > wakeup then uses the memory which has just been returned to the > pool. There is a race condition. Once back into the pool the memory > could be allocated to another thread before the call to wakeup is > made. > > Attached is a patch to fix this. > > Andrew -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss