lib-bsd socket close issues

Matthew J Fletcher amimjf at gmail.com
Fri Apr 5 10:41:57 UTC 2019


Hi,

I've not been able to reproduce either in a simple test case yet, which
would lead to the obvious conclusion that there is some fault in my
application. However, from my diagnostics i can see that a) all opened
socket FD's are being passed to close() and b) that close() is not
returning an error. The particular case is when my application tries to
connect(), which fails as the tcp port is not open.

The application is a reasonably complex multi task project that will have
lots of threads using sockets at the same time, could that be relevant ?

Interestingly i've also had problems with the httpd (mongoose) server
"leaking" if web pages are opened to quickly as well, i never really got to
the bottom of it, i just ended up at 512 sockets and hope people dont view
pages to quickly.



On Fri, 5 Apr 2019 at 07:59, Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> On 05/04/2019 01:17, Chris Johns wrote:
> > On 5/4/19 4:53 am, Matthew J Fletcher wrote:
> >> Hi Sebastian
> >>
> >> I used rtems_task_wake_after().
> >>
> >>
> >> On Thu, 4 Apr 2019, 18:22 Sebastian Huber, <
> sebastian.huber at embedded-brains.de
> >> <mailto:sebastian.huber at embedded-brains.de>> wrote:
> >>
> >>      How do you wait. Is this a busy wait?
> >>
> >>      ----- Matthew J Fletcher <amimjf at gmail.com <mailto:
> amimjf at gmail.com>> schrieb:
> >>      > replying to myself.
> >>      >
> >>      > With a 1 second pause between socket() and close() and 512
> sockets it will
> >>      > still ENOBUFS,.. without calculating it properly thats easily 10
> minutes
> >>      > since the first socket was allocated,. that must be enough time
> to start
> >>      > freeing the socket buffers internally.
> >>      >
> >>      >
> >>      > On Thu, 4 Apr 2019 at 16:47, Matthew J Fletcher <
> amimjf at gmail.com
> >>      <mailto:amimjf at gmail.com>> wrote:
> >>      >
> >>      > > Hi,
> >>      > >
> >>      > > I have noticed an issue with lib-bsd that the legacy stack
> does not have.
> >>      > >
> >>      > > If have a loop that does
> >>      > >
> >>      > > for (;;)
> >>      > > {
> >>      > >   wait(100) // milliseconds
> >>      > >   socket() // allocate
> >>      > >   close() // free
> >>      > > }
> > Are you able to make a small stand alone test?
>
> Yes, a self contained test case would be helpful. I cannot reproduce the
> issue with the modified test case in attached patch for libbsd.
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber at embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>

-- 

regards
---
Matthew J Fletcher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20190405/de635714/attachment-0002.html>


More information about the users mailing list