[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] stuck in my accept call :-(

On Fri, Dec 6, 2013 at 12:14 PM, Nick Mathewson <nickm@xxxxxxxxxxxxx> wrote:
On Thu, Dec 5, 2013 at 12:22 AM, sven falempin <sven.falempin@xxxxxxxxx> wrote:
> hello:
> libevent-2.0.21-stable
> https://forums.freebsd.org/viewtopic.php?f=35&t=43654&p=242811#p242811
> event_assign(&serv_sock_evt, evt_base,
> Â Â Â server::serv_sock_accept_pattern, this);
> event_add(&serv_sock_evt, NULL);
> then i do new in server::serv_sock_accept_pattern and path the arguments to
> accept.
> But apparently socket has nothing to accept.
> It is not easy to produce....
> help/insight welcome.

I'm not seeing an obvious problem with that code, assuming that
server::serv_sock_accept_pattern has the right signature and is
declared as 'cdecl' if that's necessary. ÂIf you're doing anything
unusual with threads, that could account for a socket appearing
readable but having nothing to accept when you look at it .. but you
probably would have thought of that.

A few possibly-not-too-helpful thoughts I have for debugging:

 1) use strace or truss or whatever the best FreeBSD syscall logging
tool is to see what exactly is going on with the fd in question. ÂAre
there weird syscalls happening to it? ÂIs something calling accept()
twice somehow?

it is ktrace :-) it has a binary format you read with kdump. If i reproduce i gonna check this.

 2) If you're multithreaded, make sure that you've enabled all the
locking stuff that you need in libevent.

done :-) was a bit messy but it looks ok now.
 3) If you haven't done so already, use helgrind and valgrind to look
for whether some kind of fishy corruption might be going on.

I always valgrind (helgrind ?) .
 4) Try to come up with a minimal program and/or testing environment
to reproduce the failing case.
 5) If it's not too hard, try dropping in evconnlistener in place of
your current listen/accept logic and see if the problem persists. If
not, it's likely an issue in your code somewhere.

 6) If you're using any awesome freebsd features like accept filters
that might affect this code path, try turning them off to see whether
that helps.

I hope one of those ideas is helpful. ÂGood luck!

Thanks a lot :-) apparently it was created by a very low backlog (set to 8 in listen call)

So to reproduce and handle the code i will(as soon as i have time) test with listen (sock, 1) and all those ideas

because rising a limit is OK, but handling the limit is better !

To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users  Âin the body.

() ascii ribbon campaign - against html e-mailÂ