lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] Sockets: select_waiting overflow


From: Stian Skjelstad
Subject: Re: [lwip-devel] Sockets: select_waiting overflow
Date: Tue, 4 Jul 2017 16:10:30 +0200

>  What is your application design since you happen to hit this assertion? Are
> you not properly keeping track of your file descriptors and sometimes ends
> up with the a "zombie" file descriptor in an another thread, or some kind of
> memory-corruptions?
>

In my implementation, if you call select() to read from a fd_set with,
say, three sockets, then lwip_select() is called three times in three
different threads, one for each socket. When there's an event in one
of them, the other two threads keep waiting, if timeout is null, then
those two threads never return. This leads sshd to create hundreds of
threads in a matter of seconds.

Hundreds of threads will cause the byte-overflow mentioned by Simon.

So, in your example you have three threads, each thread has a different file-descriptor they are responsible for, which they set in their own fd_set and call select().

And then two of the threads get stuck. I will guess that they are stuck in the semaphore sleep (I might be wrong, it often happens). I would checked the implementation of the semaphores and thread scheduling/waking up. Are you able to easily debug the sleeping threads?


Stian Skjelstad

reply via email to

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