New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_ssl logs a traceback #75501
Comments
It would be nice to not log such traceback: haypo@selma$ ./python -m test test_ssl -m test.test_ssl.ThreadedTests.test_echo
Run tests sequentially
0:00:00 load avg: 0.69 [1/1] test_ssl
Exception in thread Thread-16:
Traceback (most recent call last):
File "/home/haypo/prog/python/master/Lib/threading.py", line 917, in _bootstrap_inner
self.run()
File "/home/haypo/prog/python/master/Lib/test/test_ssl.py", line 1936, in run
if not self.wrap_conn():
File "/home/haypo/prog/python/master/Lib/test/test_ssl.py", line 1881, in wrap_conn
self.sock, server_side=True)
File "/home/haypo/prog/python/master/Lib/ssl.py", line 401, in wrap_socket
_context=self, _session=session)
File "/home/haypo/prog/python/master/Lib/ssl.py", line 808, in __init__
self.do_handshake()
File "/home/haypo/prog/python/master/Lib/ssl.py", line 1061, in do_handshake
self._sslobj.do_handshake()
File "/home/haypo/prog/python/master/Lib/ssl.py", line 683, in do_handshake
self._sslobj.do_handshake()
OSError: [Errno 0] Error 1 test OK. Total duration: 205 ms |
Python 2.7 doesn't seem to be affected. |
I don't get such traceback here (Ubuntu 16.04, OpenSSL 1.0.2g). |
I'm running Fedora 26: haypo@selma$ ./python -m test.pythoninfo|grep -E 'ssl|platform' |
Not sure if you just want to hide the presence of the exception and traceback. But regarding the exception itself (OSError with errno 0), this is not ideal. From memory, you tend to get this when the connection is shut down insecurely at the TCP level. A better exception would be SSLEOFError. Similar report in bpo-31122 (same wrap_socket → do_handshake chain). Probably also relevant: bpo-10808. |
The error occurs in the test case that uses a PROTOCOL_TLS_SERVER context for both client and server context. In that case, OpenSSL wrap_socket() fails internally and OpenSSL raises an OSError with errno 0. Simple fix: catch OSError in the client thread and fail the test appropriately. |
Thanks for the fix Christian. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: