Author martin.panter
Recipients jwilk, martin.panter, pitrou, r.david.murray, serhiy.storchaka
Date 2015-04-02.04:30:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427949001.88.0.398374025641.issue22350@psf.upfronthosting.co.za>
In-reply-to
Content
Serhiy, regarding _getresp() calling resp.decode(): You are probably right that a failure decoding the response line is recoverable in some circumstances, such a GROUP command. But in other cases, say an ARTICLE command, the response won’t have been fully drained, so the connection is no longer usable. I guess I could shift the error handling to a higher level if you think it is necessary.

Regarding the workaround in my original post: It is not a good solution, because it is still trying to send a QUIT request and wait for a response in the error handler. If you are trying to interrupt a hanging network connection for example, you have to hit Ctrl+C twice, or wait a long time for the QUIT command to get some invalid data and raise its confusing protocol error.

David: The error handling inside _getlongresp() is the main place that concerned me. But as I made the changes there I identified the other places I thought could raise unexpected exceptions (network errors) or block (therefore a KeyboardInterrupt is likely).

Draining the response might be sensible for handling an error writing to the file in some cases. My /dev/full example was actually meant to be a simple example of more complicated exceptions, such as KeyboardInterrupt, network timeouts, or if the programmer wants to peek at the start of a large message and then abort the download. So it seems my simplified test case was misleading, because in these other cases, draining the response isn’t so appropriate.
History
Date User Action Args
2015-04-02 04:30:01martin.pantersetrecipients: + martin.panter, pitrou, jwilk, r.david.murray, serhiy.storchaka
2015-04-02 04:30:01martin.pantersetmessageid: <1427949001.88.0.398374025641.issue22350@psf.upfronthosting.co.za>
2015-04-02 04:30:01martin.panterlinkissue22350 messages
2015-04-02 04:30:01martin.pantercreate