lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-users] Dying listener sockets


From: Stéphane Lesage
Subject: RE: [lwip-users] Dying listener sockets
Date: Mon, 08 Feb 2010 12:21:29 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)



> I experienced the problem that listener sockets don't accept any more
> incoming connection after some time.

Hi, I had the same problem.

> I have a server application that listens on several (8-10) ports, and
> a test client that tries to connect to those server ports, 3-6
> connections to the same port. If a connection established, after some
> (random 0.1-10s) time the client closes the connection and tries again
> in endless loop.
> Please find the pseudo-code below.
> The problem comes after ~50 reconnections (0.5-2min): one or more
> listener sockets don't accept any more connection, so those ports seem
> dead (client sends SYN, but no reply from the server). As time passes,
> even more ports dies, so I end up with 0-3 ports alive.

> - It seems that if tune my threads (sleeping a bit between two loops,
> using thread pools, etc.), the problem comes later or earlier
> (50<-->150-200 reconnections), so I suspect that some resources may be
> not protected in lwip from concurrent access. Note that I don't use
> the same socket in different threads as you can see in the code below.
> - MEMP_NUM_TCP_PCB=32, MEMP_NUM_TCP_PCB_LISTEN=16 - so I have

Then you would need NUM_NETCONN >= 48

> more incoming connections than 32, maybe that's the problem.

They should be rejected.

> - The dead listeners are stuck in sys_arch_mbox_fetch() waiting for
> message, but tcpip_thread runs happily processing incoming packets.

Upgrade to CVS head, this should solve your problems.
After some bugs have been solved after 1.3.2 (don't remember which ones) I can now make more than 300 (de)connections per second for more than 1 week. The current version is very stable, it would have been nice to have a 1.3.3 release...

With 48 sockets, you need a lot of semphores and mailboxes. Check your OS limits.
Also check your sys implementation in detail and that the stats are OK.


--
Stéphane LESAGE
ATEIS International





reply via email to

[Prev in Thread] Current Thread [Next in Thread]