Re: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection - Mailing list pgsql-hackers

From kuznet@ms2.inr.ac.ru
Subject Re: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection
Date
Msg-id 200006281624.UAA01004@ms2.inr.ac.ru
Whole thread Raw
In response to Re: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Fwd: Re: Fwd: Problem with recv syscall on socket when other side closed connection
List 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
applicationMUST 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


pgsql-hackers by date:

Previous
From: dbahena@tpv.com.mx
Date:
Subject: regular expressions troubles with char cols
Next
From: Oleg Broytmann
Date:
Subject: Re: Built with PostgreSQL (images)