You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
New changeset c506403 by Mariatta (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31320: No traceback to sys.stderr in test_ssl (GH-3360) (GH-3369) c506403
Activity
vstinner commentedon Sep 1, 2017
It would be nice to not log such traceback:
1 test OK.
Total duration: 205 ms
Tests result: SUCCESS
vstinner commentedon Sep 1, 2017
Python 2.7 doesn't seem to be affected.
pitrou commentedon Sep 1, 2017
I don't get such traceback here (Ubuntu 16.04, OpenSSL 1.0.2g).
vstinner commentedon Sep 1, 2017
I'm running Fedora 26:
haypo@selma$ ./python -m test.pythoninfo|grep -E 'ssl|platform'
platform.architecture: 32bit ELF
platform.platform: Linux-4.12.5-300.fc26.x86_64-x86_64-with-fedora-26-Twenty_Six
platform.python_implementation: CPython
ssl.HAS_SNI: True
ssl.OPENSSL_VERSION: OpenSSL 1.1.0f-fips 25 May 2017
ssl.OPENSSL_VERSION_INFO: (1, 1, 0, 6, 15)
ssl.OP_ALL: -0x7fffffac
ssl.OP_NO_TLSv1_1: 0x10000000
sys.platform: linux
vadmium commentedon Sep 4, 2017
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.
tiran commentedon Sep 5, 2017
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.
tiran commentedon Sep 5, 2017
New changeset 305e56c by Christian Heimes in branch 'master':
bpo-31320: No traceback to sys.stderr in test_ssl (bpo-3360)
305e56c
Mariatta commentedon Sep 6, 2017
New changeset c506403 by Mariatta (Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31320: No traceback to sys.stderr in test_ssl (GH-3360) (GH-3369)
c506403
vstinner commentedon Sep 13, 2017
Thanks for the fix Christian.