Re: PROBLEM: blocking read on socket repeatedly returns EAGAIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 16 August 2005 16:03, Alan Cox wrote:
> On Maw, 2005-08-16 at 15:19 +0200, Kern Sibbald wrote:
> > have written, nor does it write() anything.  When my read() is issued, I
> > expect it to block, but it immediately returns with -1 and errno set to
> > EAGAIN.  If the read() is re-issued, a CPU intensive loop results as long
> > as the other end does not read() the data written to the socket.  This is
> > a multi-threaded program, but the other threads are all blocked on
> > something.
>
> You are describing behaviour as expected with nonblocking set. That
> suggests to me that something or someone set or inherited the nonblock
> flag on that socket. 

I verified that I have not explicitly set nonblocking on the socket, so expect 
it to be default blocking. 

> Is the strange behaviour specific to the latest  kernel ?

This behavior, manifesting itself as a CPU loop, has been plaguing me for a 
number of months now.  It is not specific to the latest kernel since  it 
happened on FC3 and all kernels between.  Before FC3 I was on RHEL3 (2.4 
kernel) but am unsure if I saw the problem there, my best guess is that it is 
2.6 related, but I cannot guarantee that.

I have a workaround for the problem (sleep 200ms), but can repeat it and will 
be happy to provide more info as you request.  

The only thing I would correct in what I initially wrote is I believe that the 
other end of the socket did read some of the data I wrote before I did my 
read() expecting it to block.


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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux