This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients christian.heimes, dstufft, janssen, martin.panter, pitrou, vstinner
Date 2017-07-06.00:35:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1499301322.77.0.907705417166.issue30319@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for handling this Victor. To answer some of your earlier questions, this is my understanding of the Free BSD behaviour (although I don't have Free BSD to experiment with):

When writing to TCP sockets, I believe the data is buffered by the local OS (as well as the network, remote peer, etc). The send call will normally return straight away. In the background, the OS might combine the data with existing buffers, send it to the network, wait for acknowledgements, retransmit it, etc.

On Free BSD, steps to trigger ECONNRESET might be:

1. Establish a TCP connection.
2. Send some data to the remote peer. OS returns immediately without indicating if data will successfully be sent.
3. Remote receives data packet, but decides the connection is not valid, so responds with reset message. Maybe its socket was shut down, or the OS rebooted.
4. Close the local socket. If TCP reset message was received in time, Free BSD raises ECONNRESET.

I understand ECONNRESET is an _indication_ that not all pending data was delivered. But this is asynchronous, and a lack of ECONNRESET does not guarantee that all pending data was delivered. Imagine if steps 3 and 4 were swapped above. I doubt Free BSD will block the close call until the data is acknowledged, so it won't know if the peer will reset the connection in the future.

To guarantee the data was delivered to the application (not just the remote OS), you do need an application-level acknowledgement.

For SSL, when you call the top-level SSLSocket.close, I don't think that does much at the SSL level. Again, if you need delivery indication, I would use an app-level acknowledgement. Also beware that by default, Python doesn't report a secure EOF signal sent from the remote peer, so I think you either need a specific app-level message, or should disable the suppress_ragged_eofs mode (see Issue 27815).

Antoine: sorry for abusing the dependencies list; I will try to avoid that in the future. It seemed the easiest way to get a two-way link to a bunch of other bugs that could be duplicates, but I wasn't sure at the time. My theory was if this bug was fixed, someone could review those other bugs and see if they could also be closed.
History
Date User Action Args
2017-07-06 00:35:22martin.pantersetrecipients: + martin.panter, janssen, pitrou, vstinner, christian.heimes, dstufft
2017-07-06 00:35:22martin.pantersetmessageid: <1499301322.77.0.907705417166.issue30319@psf.upfronthosting.co.za>
2017-07-06 00:35:22martin.panterlinkissue30319 messages
2017-07-06 00:35:20martin.pantercreate