All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kern Sibbald <kern@sibbald.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: PROBLEM: blocking read on socket repeatedly returns EAGAIN
Date: Tue, 16 Aug 2005 16:38:14 +0200	[thread overview]
Message-ID: <200508161638.15129.kern@sibbald.com> (raw)
In-Reply-To: <1124200991.17555.33.camel@localhost.localdomain>

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. Is the strange behaviour specific to the latest
> kernel ?

Well, it looks like I have egg on my face; it is not a kernel problem.

Return value from fcntl(F_GETFL) in decimal, hex, octal:
rufus-fd: bnet.c:84 fcntl=2050 0x802 04002

Someone is setting nonblocking on my socket ! -- perhaps some thread library?  
Anyway, it is definitely not me, and this is a thread of the main program so 
I don't see inheritance as the problem. I'll track it down and send the bug 
report to the appropriate place.

Thanks for the fast response and sorry for the inconvenience.

Kern

  parent reply	other threads:[~2005-08-16 14:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-16 13:19 PROBLEM: blocking read on socket repeatedly returns EAGAIN Kern Sibbald
2005-08-16 14:03 ` Alan Cox
2005-08-16 14:12   ` Kern Sibbald
2005-08-16 14:52     ` Alan Cox
2005-08-16 14:38   ` Kern Sibbald [this message]
2005-08-16 18:39     ` David S. Miller
2005-08-16 21:06       ` Kern Sibbald
2005-08-16 18:37   ` David S. Miller
2005-08-16 18:36 ` David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200508161638.15129.kern@sibbald.com \
    --to=kern@sibbald.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.