-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
ssl.SSLZeroReturnError exception on startup with builtin ssl backend python 3.8 or above #517
Comments
one thing is important to note, is that there is no tcp connection made when the exception occurs, this exception is spontaneous. |
This strongly reminds me of cherrypy/cherrypy#1618. |
Well, that might be CherryPy's Checker kicking in. Have you tried disabling it? |
i disabled the checker, no difference. I tested on ubuntu 22.04 with python3.10 and the same issue. |
Oh, wait, I remember there was some kind of a TLS probe added in relatively recent releases. Maybe that's what's failing... FWIW It'd be useful to have a pure-Cheroot repro for this. |
update: tried straight cheroot and it didn't have any issues, added logging and I can definetly see the peer address so it may be a tls probe (which I haven't found in the code just yet). Another major update, is that this issue goes away when using python<3.8, no changes in cherrypy/cheroot versions, just switching between python 3.8 and python 3.7 flips this exception on and off, and they both seem to be hitting the same codepath (connection.run()) |
Okay, I monkey patched socket, and printed a stacktrace on connect and found the code. it is portend, specifically in cherrypy/process/servers.py
So everything is happening as expected. There are two questions.
I can confirm that just telnet'ing to the port and closing the connection will generate this exception under python>=3.8 and not log anything otherwise. I personally can understand leaving this issue alone, but I think it's bad as is, especially since we forcibly generate this corner case on startup. I will try to understand how python 3.7 is able to silence these 0byte tcp connections. |
adding the test code w/ monkeypatch, in case people need to debug something like this in the future.
|
I found the change in cpython that caused the issue, and submitted a pr to cheroot |
as it turns out, the cpython patch was made in response to cherrypy/cherrypy#1618 , which ended up manifesting the same exception a different way. This was a confusing bug to track down. |
I started seeing this as well after a recent Archlinux system update. I'm not entirely sure that the CPython commit linked in #518 is really to blame (after all, it also talks about The more likely culprit seems to be |
seeing more people report seeing this more often now after their os upgraded to using openssl 3.x,
|
is there any workaround to just hide these SSLZeroReturnError exceptions in the mean time? Note I am running this through a pretty standard cherrypy setup with a cherrypy.engine.start() and cherrypy.engine.block() thanks |
I am facing the issue when starting/restarting the cherrypy server,
Here is the error i am facing , Error in HTTPServer.tick
Traceback (most recent call last):
File "cheroot\server.py", line 1770, in serve
File "cheroot\server.py", line 1993, in tick
File "cheroot\connections.py", line 180, in get_conn
File "cheroot\connections.py", line 199, in _from_server_socket
File "cheroot\ssl\builtin.py", line 113, in wrap
File "ssl.py", line 517, in wrap_socket
File "ssl.py", line 1075, in _create
File "ssl.py", line 1346, in do_handshake
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:992) Version information:
is there any information on the ETA, or possible fix on this? Thanks in Advance |
β I'm submitting a ...
π Describe the bug. What is the current behavior?
I get an exception on startup. Everything seems to be working okay.
I have attached the exception, and the code used you will need to generate an ssl cert/key pair to test.
β What is the motivation / use case for changing the behavior?
π‘ To Reproduce
python test.py
this is the exception so people don't have to download the attachment. the code is a basic CherryPy startup that I grabbed from #346
exception.txt
test.py.txt
π‘ Expected behavior
startup without exception
π Details
π Environment
π Additional context
I've tried this in python3.11rc2 and python3.9, both have the issue. I do not see any similar issue if I switch to
pyopenssl backend.
The text was updated successfully, but these errors were encountered: