Hang in fd_ebadf function

Marc-André Cournoyer macournoyer at gmail.com
Fri May 30 16:12:45 CEST 2008


Perfect, it works now w/ checking the EV_ERROR bit, thx Marc!

On 29-May-08, at 12:09 AM, Marc Lehmann wrote:

> On Wed, May 28, 2008 at 01:41:58PM -0400, Marc-André Cournoyer <macournoyer at gmail.com 
> > wrote:
>> I'm playing w/ libev to make (yet another) Ruby web server and I got
>> some random issues. Sometimes the server hangs and when I attach to
>> the process w/ gdb to get the backtrace here's what I get:
>
> fd_ebadf is called when you give libev an invalid file descriptor -  
> this
> is likely an applciation bug (fd_ebadf is very slow, but select and  
> poll
> do not report *which* file descriptor is wrong, so libev has to check
> every single one).
>
> you likely see it repeatedly because you ignore the EV_ERROR bit in  
> your
> watcher and just add the file descriptor again (ignoring that bit is  
> fine
> if your code is perfect :).
>
> Both of these are application bugs - you have to make sure that the  
> file
> descriptors you give to libev are valid, open, poll'able file  
> descriptors,
> and you should check for EV_ERROR conditions and not start the watcher
> again.
>
> -- 
>                The choice of a       Deliantra, the free code 
> +content MORPG
>      -----==-     _GNU_              http://www.deliantra.net
>      ----==-- _       generation
>      ---==---(_)__  __ ____  __      Marc Lehmann
>      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
>      -=====/_/_//_/\_,_/ /_/\_\




More information about the libev mailing list