Re: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection

From: kuznet(at)ms2(dot)inr(dot)ac(dot)ru
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: dyp(at)perchine(dot)com, pgsql-hackers(at)postgresql(dot)org, davem(at)redhat(dot)com (Dave Miller), alan(at)lxorguk(dot)ukuu(dot)org(dot)uk (Alan Cox)
Subject: Re: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection
Date: 2000-06-28 16:24:24
Message-ID: 200006281624.UAA01004@ms2.inr.ac.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello!

> > This is the result of my 6 days "war" with Linux kernel people...

Alas, I did not understand that he was in the state of war.
I believed he asked for an advice and/or reported a bug. 8)

> *AND DISCARDING VALID USER DATA* at this point, the Linux kernel
> makes it impossible to retrieve the error message --- which might
> have contained essential information.

Denis was explained that Linux _never_ discards any data...
Ough, I beg pardon: Denis noticed this _himself_.
Please, do not desinform people.

BTW look at this. It is RFC1122, 4.2.2.13.

If a TCP
connection is closed by the remote site, the local
application MUST be informed whether it closed normally or
was aborted.

See? 8)

Also, David Miller explained (and Denis understood and accepted this)
that TCP does not guarantee data delivery, when an RST is issued.
It is solely due to intrinsic network unreliability and segment reordering.
The application depending on these aspects is broken.

> But what about the messages you didn't get yet, but the other end
> sent in good faith? There's nothing in the TCP specs that says
> a program can't close its end of the connection as soon as it has
> sent the last data it intends to send.

TCP specs say directly and unabiguously, that sending data
to half-closed pipe is followed by immediate abort (RFC1122, a bit
below the cite above). More detailed explanation can be found
in current draft-ietf-tcpimpl.

> Do I need to quote RFC chapter and verse at you?

Of course.

Alexey

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-06-28 16:33:14 Re: Makefile for parser
Previous Message Tom Lane 2000-06-28 16:22:35 Re: ./configure bug in CVS