This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Re: Network TCP Handler: stale socket disposal


Hi John/everybody,
The patch didn't work for me.  I still had all the sockets exhausted, and so the web server hangs, and doesn't accept any new connection.  The number of sockets I'm creating while configuring ECOS is 32.  Please see the dump of " cyg_kmem_print_stats()" below when the problem comes.

Test case: I've a script that opens and closes connection to web server every second. It takes around 2 hours to exhaust the SOCKETS zone of sockets. The TCP zone of sockets also comes down. Even if I stop the script, the sockets never recover. I'm currently debugging it(trying to understand  TCP by reading Comer and stevens).

Any ideas are welcome.

***************
cyg_kmem_print_stats() -
Network stack mbuf stats:
   mbufs 32, clusters 6, free clusters 6
   Failed to get 0 times
   Waited to get 0 times
   Drained queues to get 0 times
VM zone 'ripcb':
  Total: 32, Free: 32, Allocs: 0, Frees: 0, Fails: 0
VM zone 'tcpcb':
  Total: 32, Free: 1, Allocs: 3989, Frees: 3958, Fails: 0
VM zone 'udpcb':
  Total: 32, Free: 31, Allocs: 14, Frees: 13, Fails: 0
VM zone 'socket':
  Total: 32, Free: 0, Allocs: 10319, Frees: 3971, Fails: 6316
Misc mpool: total  131056, free   79008, max free block 77972
Mbufs pool: total  130944, free  128768, blocksize  128
Clust pool: total  262144, free  247808, blocksize 2048
*********************************************************** 

-Alok

-----Original Message-----
From: John Mills [mailto:johnmills@speakeasy.net] 
Sent: Tuesday, September 25, 2007 8:26 PM
To: Alok Singh
Cc: John Mills; eCos Users
Subject: Re: [ECOS] Re: Network TCP Handler: stale socket disposal

All -

First, please excuse my attaching a patch here, but I would like to 
respond once (or a few times &8-) in case it's helpful.

Second, my reply to Mr. Singh failed posting because it originated from a 
reader that can't enforce text-only formatting. Sorry.

Third, I post this patch for test and discussion purposes. It seems to 
help in our limited case, but comes with no guarantee. I would appreciate 
hearing others' experience.

Thanks for your patience.

 - John Mills

On Tue, 25 Sep 2007, Alok Singh wrote:

> John,
 
> Please post it in whatever form you deem as appropriate.? Let us know
> when you will be able to post it.
 
> BTW, I'm seeing a similar issue in my application.? Sockets are
> exhausted, and web is not accessible.? Ping is going through. I've kept
> Max. number of sockets as 32 while configuring ecos. The strange thing
> is that the issue comes after a long period of inactivity, i.e., no web
> activity. ??
 
> Your patch will be useful.
 
> Regards,
> Alok ?

> ________________________________________
> From: John Mills [mailto:JMills@airdefense.net] 
> Sent: Tuesday, September 25, 2007 6:56 PM
> To: Alok Singh
> Cc: ecos-discuss@ecos.sourceware.org
> Subject: RE: [ECOS] Re: Network TCP Handler: stale socket disposal
 
> All -
 
> I don't believe my patch was ever accepted. The eCos sources carry a
> cautionary note that such a 'hung' socket may have been placed on the
> net stack 'accept' queue, and may be in the process of acceptance by a
> user thread which could then block.
 
> I checked Linux and FreeBSD man pages on this. In Linux the blocked task
> would receive the next such incoming client and be unblocked. This is
> perfect for my application. Neither OpenBSD nor FreeBSD man pages
> address the issue specifically.
 
> I didn't try to replicate the race condition myself.
 
> eCos now uses an older version of the BSD stack, and updating it looks
> significant - well over a month's work, maybe 3 or 4 based on the time
> the original author reported for his port.
 
> The patch solved a show-stopping problem with our application and seems
> to cause no problems, so we're using it. Two other users tried the
> approach and wrote me off-list: in one case it resolved a problem, in
> the other it made no difference (either way, as far as I know). I can
> share the patch on a "no warranty" basis, but would prefer to post it
> appropriately rather than circulating it randomly.
 
> ?- John Mills


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]