On Wed, Jul 28, 2010 at 07:56:41PM +0000, Grant Edwards wrote: > On 2010-07-28, Grant Edwards <grant.b.edwa...@gmail.com> wrote: > > On 2010-07-27, Grant Edwards <grant.b.edwa...@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. > > AFAICT, the leak occurs in kern/sockio.c in bsd_accept():
This makes sense. This is eCos code, not code taken directly from FreeBSD. > When an error is returned, the accept() function in > io/fileio//socket.cxx frees the file pointer and file descriptor but > not the socket: I would not expect it to. It does not know anything about sockets, they are internal to the stack. > So, nowhere does the socket get freed. > Where should the socket be freed? In bsd_accept() where it is removed > from the queue? Or in socket.cxx when the fd/fp are freed? I would say in bsd_accept(). However, it would be good to find the FreeBSD code equivalent of this code and see where it frees the socket. 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