Re: epoll gives broken results when interrupted with a signal

From: Davide Libenzi
Date: Fri Oct 31 2003 - 18:01:03 EST


On Thu, 30 Oct 2003, Ben Mansell wrote:

> On Thu, 30 Oct 2003, Ben Mansell wrote:
>
> > On Wed, 29 Oct 2003, Davide Libenzi wrote:
> >
> > > Can you try the patch below and show me a dmesg when this happen?
> >
> > Ok, patch applied. (I changed DEBUG_EPOLL to 10 however, otherwise
> > nothing would be printed). Now, epoll appears to behave perfectly and I
> > can't re-create the problem :(
>
> Got it! I was missing the problem because I had removed some debug
> messages in my own code. Here's another run, this time the
> final epoll_wait() call of the child process brings back 2 events:
> Event 0 fd: 7 events: 17
> Event 1 fd: -2095926561 events: 0

It is really strage. If you look what epoll sees:

> [0000010002ba7520] eventpoll: polling file=00000100099822c0 ep=000001001f928000 epi=000001000d9c6a80
> [0000010002ba7520] eventpoll: pollres file=00000100099822c0 ep=000001001f928000 epi=000001000d9c6a80 events=17
> [0000010002ba7520] eventpoll: polling file=000001000615d980 ep=000001001f928000 epi=000001000d9c69c0
> [0000010002ba7520] eventpoll: pollres file=000001000615d980 ep=000001001f928000 epi=000001000d9c69c0 events=16
> [0000010002ba7520] eventpoll: sys_epoll_wait(3, 000000000073e390, 32, 1000) = 2
> [0000010002ba7520] eventpoll: eventpoll_release_file(00000100099822c0)
> [0000010002ba7520] eventpoll: remove ep=000001001f928000 epi=000001000d9c6a80
> [0000010002ba7520] eventpoll: ep_unlink(000001001f928000, 00000100099822c0) = 0
> [0000010002ba7520] eventpoll: ep_remove(000001001f928000, 00000100099822c0) = 0
> [0000010002ba7520] eventpoll: eventpoll_release_file(000001000615d980)
> [0000010002ba7520] eventpoll: remove ep=000001001f928000 epi=000001000d9c69c0
> [0000010002ba7520] eventpoll: ep_unlink(000001001f928000, 000001000615d980) = 0
> [0000010002ba7520] eventpoll: ep_remove(000001001f928000, 000001000615d980) = 0
> [0000010002ba7520] eventpoll: close() ep=000001001f928000

It clearly sees two events with masks 16 and 17. And at this points events
are already inside a buffer ready to be pushed to usespace with a
copy_to_user().



- Davide

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/