From: "David Schwartz" <davids@webmaster.com>
To: "Stephen Hemminger" <shemminger@vyatta.com>
Cc: <linux-net@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: RE: recv() hangs until SIGCHLD ?
Date: Sat, 11 Oct 2008 05:20:37 -0700 [thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKKEFHAFAD.davids@webmaster.com> (raw)
In-Reply-To: <48F063C5.3000707@motion-twin.com>
Nicolas Cannasse wrote:
> The sockets are non-blocking.
Ouch, that's a serious bug. Non-blocking operations shouldn't block!
> Checking with netstat and ss I can confirm that both Send and Recv
> queues are empty, which makes the recv() behavior consistent.
>
> However since this problem does not occur without threads, we can be
> sure that the blame is still on the receiver.
>
> In a practical case, we have a thread blocked in recv() for more than 12
> hours, which is way beyond the timeout of the sender connection. The
> socket has already been closed by the sender so recv() should at least
> be noticed and returns 0.
Can you clarify what you mean by "the socket has already been closed by the
sender"? You mean the other end of the TCP connection shut it down? By "the
socket", you don't mean the socket you called 'recv' on, right? You mean the
socket on the other end that's connected to it?
> Is it safe to assume that when either send() or recv() get interrupted
> by a signal and returns EINTR, no actual data has been either sent or
> consumed ? And if it's not, is there any other way around this ?
EINTR can only be return if 'send' or 'recv' have not sent or received
anything. Otherwise the connection would be left in an indeterminate state.
DS
next prev parent reply other threads:[~2008-10-11 12:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-10 13:30 Nicolas Cannasse
2008-10-10 19:17 ` Stephen Hemminger
2008-10-11 8:28 ` Nicolas Cannasse
2008-10-11 12:20 ` David Schwartz [this message]
2008-10-12 15:47 ` Stephen Hemminger
2008-10-13 8:31 ` Nicolas Cannasse
2008-10-13 15:02 ` Nicolas Cannasse
2008-10-10 16:43 Nicolas Cannasse
2008-10-11 4:48 ` David Schwartz
2008-10-11 9:30 ` Samuel Thibault
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=MDEHLPKNGKAHNMBLJOLKKEFHAFAD.davids@webmaster.com \
--to=davids@webmaster.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net@vger.kernel.org \
--cc=shemminger@vyatta.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®