Author vstinner
Recipients vstinner
Date 2015-04-02.15:30:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427988624.66.0.803600947043.issue23853@psf.upfronthosting.co.za>
In-reply-to
Content
The _ssl module uses an helper function check_socket_and_wait_for_timeout() to poll until the socket is ready (got data or became writable). check_socket_and_wait_for_timeout() always uses the socket timeout. If select() or poll() is interrupted by a signal (fails with EINTR), check_socket_and_wait_for_timeout() is restarted with the same timeout, which doesn't respect the contract of the timeout: the operation must timeout if it takes more than timeout seconds.

The code must be modified to recompute the timeout, as done in the new sock_call() function of Modules/socketmodule.c (issue #23618). At least, the timeout must decreases when select()/poll() fails with EINTR.

Currently, the timeout is reset after each read/write/handshake operation. IMO the timeout must apply on the total duration of the ssl method, not be reset. But changing this may break backward compatibility :-/

Note: if the signal handler raises an exception, the ssl method fails with the exception. This issue is specific to signal handlers not raising an exception.
History
Date User Action Args
2015-04-02 15:30:24vstinnersetrecipients: + vstinner
2015-04-02 15:30:24vstinnersetmessageid: <1427988624.66.0.803600947043.issue23853@psf.upfronthosting.co.za>
2015-04-02 15:30:24vstinnerlinkissue23853 messages
2015-04-02 15:30:24vstinnercreate