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

Re: [Libevent-users] event_base_dispatch returning -1 - help debugging



On Thu, Jun 7, 2012 at 4:59 PM, Julian Bui <julianbui@xxxxxxxxx> wrote:
> Hi everyone,
>
> I am having trouble with my libevent 2.0.18 server.  The dispatch loop keeps
> returning -1 and I cannot determine the cause.
>
> I have not tried searching the mailing list as there does not seem to be a
> search option (http://archives.seul.org/libevent/users/)

Step one might be to build with debugging support and try that log
trick again, with debugging logs enabled; that might shed some light
on what's going on.

It sounds (Based on your mention of WSAGetLastError()) like you're
using windows here.  The only ways that I can see for win32select's
win32_dispatch functino to return -1 are if select() returns -1, or
realloc returns -1.

A select() failure seems likelier.  You could set a debugging
tracepoint at the part of win32_dispatch that says:
   if (res <= 0) {
      return res;
   }
and see if it ever returns with res = -1, and if so what the value of
WSAGetLastError is.  Or you could insert a printf there if you don't
want to mess with the debugger.

Do any of the error codes in the documentation for select() seem
plausible to you?  The likeliest one as far as I can tell is that
there is a nonexistent (or no-longer-existent) socket still in the
list of sockets that select() is looking at.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.