public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Miquel van Smoorenburg" <miquels@cistron.nl>
To: linux-kernel@vger.kernel.org
Subject: Re: TCP hangs in 2.4 - blocking write() in wait_for_tcp_memory
Date: Wed, 30 Oct 2002 12:44:22 +0000 (UTC)	[thread overview]
Message-ID: <apok75$84t$2@ncc1701.cistron.net> (raw)
In-Reply-To: 20021030122812.GA5182@outpost.ds9a.nl

In article <20021030122812.GA5182@outpost.ds9a.nl>,
bert hubert  <ahu@ds9a.nl> wrote:
>On Wed, Oct 30, 2002 at 10:44:20AM +0000, Miquel van Smoorenburg wrote:
>
>> This makes both socket programs hang in write(), in wait_for_tcp_memory.
>> Shouldn't the kernel return a short write, instead of hanging
>> both processes ? select() returned writeability.
>
>write(2) is allowed to do a short write on a blocking socket, but not
>mandated to do so. In fact I've only seen short writes under
>linux on non-blocking sockets.
>
>SuSv3 says:

Ah, that's interesting:

> Blocking/immediate: Blocking is only possible with O_NONBLOCK clear. If
> there is enough space for all the data requested to be written immediately,
> the implementation should do so. Otherwise, the process may block; that is,

Okay, _may_ block. That's what I needed to know. So it's not a kernel
bug, but a bug in applications like socket(1) and nc(1).

With squid I see corrupted downloads, that probably means squid does
use non-blocking sockets but doesn't handle short writes correctly.

> Partial and deferred writes are only possible with O_NONBLOCK set.

Thanks for the clarification.

Now I must go fix all those programs :/

Mike.


      reply	other threads:[~2002-10-30 12:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-29 16:51 TCP hangs in 2.4.20-pre11 (and 2.4.19) Miquel van Smoorenburg
2002-10-30 10:44 ` TCP hangs in 2.4 - blocking write() in wait_for_tcp_memory Miquel van Smoorenburg
2002-10-30 12:28   ` bert hubert
2002-10-30 12:44     ` Miquel van Smoorenburg [this message]

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='apok75$84t$2@ncc1701.cistron.net' \
    --to=miquels@cistron.nl \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox