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 gchauvel
Recipients christian.heimes, gchauvel
Date 2021-03-30.08:40:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617093623.29.0.705847641545.issue43622@roundup.psfhosted.org>
In-reply-to
Content
Based on your first comment, poll returning an event and recv not able to read data is a behavior to expect with TLSv1.2/TLSv1.3 (or ...)
So in order to use SSLContext in a polling loop with multiple file descriptors, a non-blocking mode (to avoid an fd event and not being able to read data) is mandatory. Do you agree with this statement ?

Furthermore, I looked at [1], the other tests in test_ssl.py and also set a few traces in _ssl.c

- without non blocking mode: even with a fd event, the test blocks on SSL_read
- with non blocking mode: SSL_read returns a negative value, PySSL_SetError throws PySSLWantWriteErrorObject, but:

    nothing is printed on the console, a thread is blocked at PyThread_acquire_lock_timed, so the test hangs forever.

- with non blocking mode + try/except ssl.SSLWantReadError [2], the test is ok

[1] https://docs.python.org/3/library/ssl.html#ssl-nonblocking
[2] https://github.com/g-chauvel/cpython/commit/dc57cbea3558ff7b3c040326709d9b759214584a
History
Date User Action Args
2021-03-30 08:40:23gchauvelsetrecipients: + gchauvel, christian.heimes
2021-03-30 08:40:23gchauvelsetmessageid: <1617093623.29.0.705847641545.issue43622@roundup.psfhosted.org>
2021-03-30 08:40:23gchauvellinkissue43622 messages
2021-03-30 08:40:22gchauvelcreate