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

Re: [Libevent-users] Handling POLLHUP in evport.c



On Wed, Dec 29, 2010 at 6:07 AM, Yee Keat Phuah <ykphuah@xxxxxxxxx> wrote:
> Hi,
>
> Recently I came across a scenario where I added a unix pipe in
> bufferevent, but then when the pipe is closed, I experience an
> infinite loop.
>
> This happens in Solaris 10 using evport by default.
>
> Its traced down to evport.c:460.

What version were you looking at?   The ones I'm looking at now don't
have anything interesting on line 460 of evport.c.

> Contrary to devpoll.c, epoll.c and poll.c, there's no handling of
> POLLHUP, which is what I see returned in my usage of libevent, hence
> the events will be 0, it then will trigger an infinite loop in the
> base loop.
>
> Putting out a test program to reproduce this will take some time,
> hence I hope this is an obvious bug that the maintainer of evport.c
> can respond to, from the limited information above?

Sadly, there aren't any evport experts on the Libevent team right now;
I can look at the code well enough to try to guess what it's doing,
but it seems like you probably know the Solaris APIs better than I do.
 (I've got nothing against Solaris, but it's not a system I've used
regularly since the 90s.)

I _think_ what you're suggesting is something like adding

 		if (pevt->portev_events & (POLLERR|POLLHUP))
			res |= EV_READ|EV_WRITE;

to the final loop of evport_dispatch?  Does that solve the problem for you?

If not, could you maybe send (or ideally upload to the patch tracker!)
a patch that has the fix you think is right?

many thanks & happy new year,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.