RE: select() fails... sometimes

=?iso-8859-1?Q?Miguel_Angel_Garc=EDa_Grande?= (mgarcia@bjssoft.es)
Thu, 20 May 1999 18:24:59 +0200


Thank you very much, Kurt.

The reason seems to be a feature I didn't know: If select() indicates you
can read from a handle but read() really gets nothing, it means the handle
has some kind of error (connection closed, etc).

Anyway I'll reset errno... it's better to prevent. :-)

Thanks again!

-----Original Message-----
From: Kurt Garloff [mailto:garloff@suse.de]
Sent: 20 May 1999 18:05
To: mgarcia@bjssoft.es
Cc: linux-kernel@vger.rutgers.edu
Subject: Re: select() fails... sometimes

On Tue, May 18, 1999 at 11:46:16AM -0000, mgarcia@bjssoft.es wrote:
> I have a problem using select() on several handles.
> It does work fine but, under some circumstances, it returns inmediately
> ignoring the timeout argument, indicating that handle zero (stdin linked
> to a socket via inetd) has something to read, but "read()" gets nothing at
> all.
>
> Once it happens it doesn't stop until something is received by some other
> handle. It's very annoying since the CPU load grows enormeously.

I once had a similar problem, but IIRC, it was caused by a buggy libc5.
It was worked around by explicitly setting errno to zero, before calling
select ().

Just an idea ...

--
Kurt Garloff  <garloff@suse.de>           SuSE GmbH, Nürnberg, FRG
Linux kernel development;    SCSI driver: DC390 (tmscsim/AM53C974)

- 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/