[issue41450] OSError is not documented in ssl library, but still can be thrown

New submission from Alexander Sibiryakov <sixty-one@yandex.ru>: See stack trace [07/15/2020 08:51:14.799: ERROR/kafka.producer.sender] Uncaught error in kafka producer I/O thread Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/kafka/producer/sender.py", line 60, in run self.run_once() File "/usr/local/lib/python3.6/site-packages/kafka/producer/sender.py", line 160, in run_once self._client.poll(timeout_ms=poll_timeout_ms) File "/usr/local/lib/python3.6/site-packages/kafka/client_async.py", line 580, in poll self._maybe_connect(node_id) File "/usr/local/lib/python3.6/site-packages/kafka/client_async.py", line 390, in _maybe_connect conn.connect() File "/usr/local/lib/python3.6/site-packages/kafka/conn.py", line 426, in connect if self._try_handshake(): File "/usr/local/lib/python3.6/site-packages/kafka/conn.py", line 505, in _try_handshake self._sock.do_handshake() File "/usr/local/lib/python3.6/ssl.py", line 1077, in do_handshake self._sslobj.do_handshake() File "/usr/local/lib/python3.6/ssl.py", line 689, in do_handshake self._sslobj.do_handshake() OSError: [Errno 0] Error See docs https://docs.python.org/3.8/library/ssl.html and see source code: https://github.com/python/cpython/blob/3.8/Modules/_ssl.c Probably the best would be to proceed with using SSLError, but short term OSError could be documented. ---------- assignee: docs@python components: Documentation messages: 374644 nosy: docs@python, sibiryakov priority: normal severity: normal status: open title: OSError is not documented in ssl library, but still can be thrown type: behavior versions: Python 3.8 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________

Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- components: +SSL _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________

Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- nosy: +christian.heimes _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________

Martin Panter <vadmium+py@gmail.com> added the comment: Issue 31122 is also open about fixing this long-term, but I agree it would be good to document this quirk / bug. ---------- nosy: +martin.panter _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________

Allan Chandler <lynneandallan@optusnet.com.au> added the comment: If you look through the source for PyExc, you'll find items for (over and above OsError) ValueError, NotImplementedError, TypeError, OverflowError, AttributeError, MemoryError, UnicodeEncodeError, and RuntimeWarning. I don't think ANY of those are documented so are we going to fix them all? Or should we just list them as possibilities in the doco (or, even more vaguely, state that exceptions other than the documented SSL ones are also possible)? ---------- nosy: +paxdiablo _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________

Change by Jeffrey Kintscher <websurfer@surf2c.net>: ---------- nosy: +Jeffrey.Kintscher _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________

Senthil Kumaran <senthil@uthcode.com> added the comment: This is resolved by Issue 31122 and code now raises SSLEOFError instead of OSError. The reason for OSError in the first place was PySSL_SetError function had the following call s->errorhandler(); https://github.com/python/cpython/blob/3.7/Modules/_ssl.c#L782 Where the errorhandler of socketmodule.c was called, and error message that raised was OSError (https://github.com/python/cpython/blob/master/Modules/socketmodule.c#L607) --- In issue31122, Dima.Tisnek contributed a patch to remove the s-errorhandler() and replace it with SSLEOFError https://github.com/python/cpython/commit/495bd035662fda29639f9d52bb6baebea31... Since the patch was ported to 3.8 and 3.9, OSError is no longer raised by the ssl module for the do_handshake call or wherever PySSL_SetError is utilized. Closing this bug report as resolved. ---------- assignee: docs@python -> orsenthil nosy: +Dima.Tisnek, orsenthil resolution: -> fixed stage: -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________

Change by Senthil Kumaran <senthil@uthcode.com>: ---------- components: +Library (Lib) -Documentation versions: +Python 3.10, Python 3.9 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue41450> _______________________________________
participants (6)
-
Alexander Sibiryakov
-
Allan Chandler
-
Jeffrey Kintscher
-
Karthikeyan Singaravelan
-
Martin Panter
-
Senthil Kumaran