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: Socket leak when accept() is aborted by TCP RST?


On 2010-07-27, Grant Edwards <grant.b.edwards@gmail.com> wrote:

> I'm seeing what appears to me to be a socket leak in the accept()
> operation provided by the "new" BSD network stack.

The stack is definitely leaking sockets.  I can now reliably reproduce
the problem by opening a TCP connection and then immediately causing a
TCP reset.

I've got 9 open sockets to start with, and max sockets is configured
to be 256.  After repeating the open/reset sequence 244 times, I get
an "DEBUG: Out of sockets - waiting" message that repeats periodically
(but never recovers).

At that point, I can still ping the eCos system, but no new
connections can be opened.

In case anybody else would like to try it, here's a win32 program that
opens/resets a tcp connection 4 times per second:

http://www.panix.com/~grante/files/ecos/winopenclose.c
http://www.panix.com/~grante/files/ecos/winopenclose.exe

The accept() call will return -1 with errno==353 when the socket is
leaked.

-- 
Grant Edwards               grant.b.edwards        Yow! ... the MYSTERIANS are
                                  at               in here with my CORDUROY
                              gmail.com            SOAP DISH!!


-- 
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]