Repository navigation
Test failures with Python 3.13.6 #1648
Copy link
Copy link
Closed
Labels
Description
With Python 3.13.6 (up from 3.13.5) we started seeing test failures around TLS connections in the test suite on 15.0.1 (and also on 91abba4).
websockets> unittest flags: ''
websockets> .......................................sssssssssssssss.......ssssssss...................................................................................................................................................................s....s.s........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ss...............................................................................................................................................................................................................................................................................................................................................................E...........................sssssssssssssssE..EEssssssss.E.E.................................................s..............................................................s.s...............................s...................................................................................................................E.E............E..E.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
websockets> ======================================================================
websockets> ERROR: test_ssl_context_argument (tests.sync.test_client.BackwardsCompatibilityTests.test_ssl_context_argument)
websockets> Client supports the deprecated ssl_context argument.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_client.py", line 712, in test_ssl_context_argument
websockets> with connect(get_uri(server), ssl_context=CLIENT_CONTEXT):
websockets> ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_connection (tests.sync.test_client.SecureClientTests.test_connection)
websockets> Client connects to server securely.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_client.py", line 261, in test_connection
websockets> with connect(get_uri(server), ssl=CLIENT_CONTEXT) as client:
websockets> ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_set_server_hostname_explicitly (tests.sync.test_client.SecureClientTests.test_set_server_hostname_explicitly)
websockets> Client sets server_hostname to the value provided in argument.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_client.py", line 278, in test_set_server_hostname_explicitly
websockets> with unix_connect(
websockets> ~~~~~~~~~~~~^
websockets> path, ssl=CLIENT_CONTEXT, server_hostname="overridden"
websockets> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> ) as client:
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 419, in unix_connect
websockets> return connect(uri=uri, unix=True, path=path, **kwargs)
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_set_server_hostname_implicitly (tests.sync.test_client.SecureClientTests.test_set_server_hostname_implicitly)
websockets> Client sets server_hostname to the host in the WebSocket URI.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_client.py", line 269, in test_set_server_hostname_implicitly
websockets> with unix_connect(
websockets> ~~~~~~~~~~~~^
websockets> path, ssl=CLIENT_CONTEXT, uri="wss://overridden/"
websockets> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> ) as client:
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 419, in unix_connect
websockets> return connect(uri=uri, unix=True, path=path, **kwargs)
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_secure_connection (tests.sync.test_client.UnixClientTests.test_secure_connection)
websockets> Client connects to server securely over a Unix socket.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_client.py", line 620, in test_secure_connection
websockets> with unix_connect(path, ssl=CLIENT_CONTEXT) as client:
websockets> ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 419, in unix_connect
websockets> return connect(uri=uri, unix=True, path=path, **kwargs)
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_set_server_hostname (tests.sync.test_client.UnixClientTests.test_set_server_hostname)
websockets> Client sets server_hostname to the host in the WebSocket URI.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_client.py", line 629, in test_set_server_hostname
websockets> with unix_connect(
websockets> ~~~~~~~~~~~~^
websockets> path, ssl=CLIENT_CONTEXT, uri="wss://overridden/"
websockets> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> ) as client:
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 419, in unix_connect
websockets> return connect(uri=uri, unix=True, path=path, **kwargs)
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_secure_redirect (tests.sync.test_router.RouterTests.test_secure_redirect)
websockets> Router redirects connections to a wss:// URI when TLS is enabled.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_router.py", line 83, in test_secure_redirect
websockets> with connect(get_uri(server) + "/r", ssl=CLIENT_CONTEXT):
websockets> ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_ssl_context_argument (tests.sync.test_server.BackwardsCompatibilityTests.test_ssl_context_argument)
websockets> Server supports the deprecated ssl_context argument.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_server.py", line 574, in test_ssl_context_argument
websockets> with connect(get_uri(server), ssl=CLIENT_CONTEXT):
websockets> ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_connection (tests.sync.test_server.SecureServerTests.test_connection)
websockets> Server receives secure connection from client.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_server.py", line 346, in test_connection
websockets> with connect(get_uri(server), ssl=CLIENT_CONTEXT) as client:
websockets> ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ======================================================================
websockets> ERROR: test_connection (tests.sync.test_server.SecureUnixServerTests.test_connection)
websockets> Server receives secure connection from client over a Unix socket.
websockets> ----------------------------------------------------------------------
websockets> Traceback (most recent call last):
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 963, in send_context
websockets> self.send_data()
websockets> ~~~~~~~~~~~~~~^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1029, in send_data
websockets> self.socket.sendall(data)
websockets> ~~~~~~~~~~~~~~~~~~~^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1263, in sendall
websockets> v = self.send(byte_view[count:])
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/ssl.py", line 1232, in send
websockets> return self._sslobj.write(data)
websockets> ~~~~~~~~~~~~~~~~~~^^^^^^
websockets> ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2502)
websockets>
websockets> The above exception was the direct cause of the following exception:
websockets>
websockets> Traceback (most recent call last):
websockets> File "/build/source/tests/sync/test_server.py", line 380, in test_connection
websockets> with unix_connect(path, ssl=CLIENT_CONTEXT) as client:
websockets> ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 419, in unix_connect
websockets> return connect(uri=uri, unix=True, path=path, **kwargs)
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 378, in connect
websockets> connection.handshake(
websockets> ~~~~~~~~~~~~~~~~~~~~^
websockets> additional_headers,
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> user_agent_header,
websockets> ^^^^^^^^^^^^^^^^^^
websockets> deadline.timeout(),
websockets> ^^^^^^^^^^^^^^^^^^^
websockets> )
websockets> ^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/client.py", line 85, in handshake
websockets> with self.send_context(expected_state=CONNECTING):
websockets> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
websockets> File "/nix/store/lcpjgrp7x4f9rv5zhdcbbysg11ia33f3-python3-3.13.6/lib/python3.13/contextlib.py", line 148, in __exit__
websockets> next(self.gen)
websockets> ~~~~^^^^^^^^^^
websockets> File "/nix/store/551prrpxwx2fvcglb9pzkr0zgl8lg8yb-python3.13-websockets-15.0.1/lib/python3.13/site-packages/websockets/sync/connection.py", line 1012, in send_context
websockets> raise self.protocol.close_exc from original_exc
websockets> websockets.exceptions.ConnectionClosedError: no close frame received or sent
websockets>
websockets> ----------------------------------------------------------------------
websockets> Ran 1947 tests in 177.421s
Reactions are currently unavailable
Activity
aaugustin commentedon Aug 9, 2025
I could reproduce on macOS on my first attempt, while you're on Linux, so this looks like a reproducible platform-independent problem. (Phew.)
Also, the tests don't just fail; they also hang for 10 seconds — which is the default close timeout for connections — before failing.
python/cpython#134724 is a candidate in the right area: it's a fix for a bug involving custom certificates and threads and it adds a lock; the failing tests involve custom certificates and threads and they're blocking now. However, it isn't completely obvious that it's the cause of the problem.
The next step would be to write a minimal reproduction without websockets to prove that it's a Python problem.
aaugustin commentedon Aug 9, 2025
Reducing the problem to a single failing test (every failure follows the same pattern) and adding logs:
Here we can see that the client is sending data over the TLS-encrypted connection but the server never gets it.
After 10 seconds, the opening handshake timeout triggers on the server side. (Not the close timeout like I thought at first.)
The socket is then closed on the server side, leading to the error under
websockets.server ! error while receiving data.From the client perspective, it hasn't finished sending the data yet, probably because it's waiting for a TLS acknowledgement, as visible in the error under
websockets.client ! error while sending data.aaugustin commentedon Aug 9, 2025
Here's a minimal reproduction:
aaugustin commentedon Aug 9, 2025
Upstream issue filed against CPython here: python/cpython#137583
ZeroIntensity commentedon Aug 14, 2025
Upstream issue has been fixed in 3.13.7, which was just released.
aaugustin commentedon Sep 28, 2025
For some reason this issue attracts spam. Locking in the hope of preventing it.