Re: Signals lost when using asynchronous IO

From: Shane Nay (shane@isupportlive.com)
Date: Wed Jul 12 2000 - 12:55:48 EST


On Wed, 12 Jul 2000, you wrote:
> I'm trying to use non-blocking asynchronous IO, setting a user-defined
> real-time signal to be sent when IO is completed on a socket. This works
> fine most of the time, and I get the specified signal when new data is
> available. However, sometimes signals appear to be lost. Debugging
> indicates that this happens when the remote end closes the socket. The
> problem only occurs when there are many sockets active, all using
> asynchronous IO, and many signals are to be sent. And, yes, I do check for
> SIGIO signals too, but none are sent (i.e. the IO list is not saturated).
>
> The sockets are created as (AF_INET, SOCK_STREAM), and are set to be
> O_NONBLOCK|O_ASYNC using fcntl(). The user-defined signal is the first
> real-time signal (value 32).
>
> Is this a known problem, and if so, is there a work-around?
>
> System: i386 (Pentium II)/Red Hat Linux release 6.0 (Hedwig)
> Kernel: 2.2.16
>
> Thank you,
> Mikael

I have done a lot of testing with async i/o with the kernel that comes with
RH6.2 which is the same as you're referencing. On close a POLL_HUP and then a
POLL_IN get sent to the app. I'm using sigtimedwait && sigwaitinfo rather than
poll. If you're looking for sample implementations you can get phhttpd at
zabbo.net, or I just put up a sample implementation which is designed to be a
sigio library (just beginning few bugs hanging around) its on anon ftp at
isupportlive.com/pub/libfio.tar.gz . The source is very small and it's pretty
easy to understand. I can't help but think possibly your implementation is off
because I haven't experienced the problems your speaking of, are you removing
the O_ASYNC flag before the close event or something?

Anyhoo, for a lot of people generally interested in async io you may want to
check out the phhttpd list, instructions are on www.zabbo.net. You might want
to repost to that list, Chuck, Zach, Stephen, Andi and myself are known to
answer there. (Though my kernel's been Oopsing lately in the response category
<this is a joke, attempted one anyway>)

Later,
Shane.

(Phhttpd has handling code for both signal driven and poll, so it might be more
interesting to you. The present version is designed for your kernel version as
well as that's the one Chuck Lever runs and he put out the last revision.)

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



This archive was generated by hypermail 2b29 : Sat Jul 15 2000 - 21:00:15 EST