Skip to content
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

cherrypy SSL stops responding "ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)" (after 5 intermediate tracebacks TLSV1_ALERT_UNKNOWN_CA or SSLV3_ALERT_CERTIFICATE_UNKNOWN) #346

Open
1 of 3 tasks
sanderjo opened this issue Dec 8, 2020 · 7 comments
Labels
bug Something is broken

Comments

@sanderjo
Copy link
Contributor

sanderjo commented Dec 8, 2020

Hi,

SABnzbd sub-author here, CC to @Safihre

I'm not sure if this is cheroot or cherrypy. The PoC program does a "import cherrypy", and the traceback is in cheroot, so I'm reporting this under cheroot.

I'm submitting a ...

  • 🐞 bug report
  • 🐣 feature request
  • ❓ question about the decisions made in the repository

🐞 Describe the bug. What is the current behavior?
After 5 combined (failed) SSL/TLS connections from a certain SSL client (Radarr 3.0.0.4204, based on .NET Core), cherrypy stops responding completely with ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
The program is still 'running'

Reproducable on Windows 10.
FWIW self-signed-certificate

What is the motivation / use case for changing the behavior?

Cherrypy stops responding.

💡 To Reproduce

Start minimal cherrypy HTTPS server:

import cherrypy
import sys

print("python version:", sys.version)
print("cherrpy version:", cherrypy.__version__)

class RootServer:
    @cherrypy.expose
    def index(self, **keywords):
        return "it works!"

if __name__ == '__main__':
    server_config={
        'server.socket_host': '127.0.0.1',
        'server.socket_port': 4400,
        'server.ssl_module': 'builtin',
        #'server.ssl_module':'pyopenssl',
        'server.ssl_certificate':'server.cert',
        'server.ssl_private_key':'server.key'
    }

    cherrypy.config.update(server_config)
    cherrypy.quickstart(RootServer())

Let Radarr 3.0.0.4204 connect 5 times. Cherrypy spits out tracebacks, and after 5th attempt stops responding completely.

💡 Expected behavior

No tracebacks, keep responding.
Or, maybe as a workaround, cherrypy/cheroot can respawn itself (just like it does if it detects a new config)?

📋 Details

See below

📋 Environment

  • Cheroot version: 8.4.5 and 8.5.0
  • CherryPy version: 18.6.0
  • Python version: 3.8.6 and 3.9.0
  • OS: Windows 10
  • Browser: Radarr 3.0.0.4204 client written in .NET Core (3.1.10); Note: I'm not the author of that program

📋 Additional context

Full program output, including tracebacks

C:\mini-cherrypy>python mini-cherrypy-server.py
python version: 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
cherrpy version: 18.6.0
[08/Dec/2020:10:10:12] ENGINE Listening for SIGTERM.
[08/Dec/2020:10:10:12] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[08/Dec/2020:10:10:12] ENGINE Set handler for console events.
[08/Dec/2020:10:10:12] ENGINE Started monitor thread 'Autoreloader'.
[08/Dec/2020:10:10:12] ENGINE Serving on https://127.0.0.1:4400
[08/Dec/2020:10:10:12] ENGINE Bus STARTED
[08/Dec/2020:10:10:15] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

[08/Dec/2020:10:10:15] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

Exception in thread CP Server Thread-4:
Traceback (most recent call last):
Exception in thread CP Server Thread-5:
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    success = self.read_request_line()
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    current = self.raw.read(to_read)
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self.read(nbytes, buffer)
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
    return self._sslobj.read(len, buffer)
    keep_conn_open = conn.communicate()
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate

During handling of the above exception, another exception occurred:

    self._conditional_error(req, '500 Internal Server Error')
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    req.simple_response(response)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
    self.run()
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    keep_conn_open = conn.communicate()
    res = super().write(val, *args, **kwargs)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    self._conditional_error(req, '500 Internal Server Error')
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
    req.simple_response(response)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    res = super().write(val, *args, **kwargs)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
[08/Dec/2020:10:10:16] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

Exception in thread CP Server Thread-6:
[08/Dec/2020:10:10:16] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
Exception in thread CP Server Thread-7:
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    success = self.read_request_line()
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    success = self.read_request_line()
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
    keep_conn_open = conn.communicate()
    keep_conn_open = conn.communicate()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
    self._conditional_error(req, '500 Internal Server Error')
    self._conditional_error(req, '500 Internal Server Error')
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
    req.simple_response(response)
    req.simple_response(response)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
    self.conn.wfile.write(EMPTY.join(buf))
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    res = super().write(val, *args, **kwargs)
    res = super().write(val, *args, **kwargs)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    self._flush_unlocked()
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
    n = self.raw.write(bytes(self._write_buf))
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    return self._sock.send(b)
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    return self._sslobj.write(data)
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
[08/Dec/2020:10:10:18] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

Exception in thread CP Server Thread-8:
[08/Dec/2020:10:10:18] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
Exception in thread CP Server Thread-9:
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
Traceback (most recent call last):
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    data = self.rfile.readline(256)
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    b = self.read(nreadahead())
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    return self._peek_unlocked(size)
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    self.run()
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
    keep_conn_open = conn.communicate()
    keep_conn_open = conn.communicate()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
    self._conditional_error(req, '500 Internal Server Error')
    self._conditional_error(req, '500 Internal Server Error')
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
    req.simple_response(response)
    req.simple_response(response)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    res = super().write(val, *args, **kwargs)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    res = super().write(val, *args, **kwargs)
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    self._flush_unlocked()
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
[08/Dec/2020:10:10:19] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

Exception in thread CP Server Thread-10:
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
[08/Dec/2020:10:10:19] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
Exception in thread CP Server Thread-11:
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    request_line = self.rfile.readline()
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    success = self.read_request_line()
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    b = self.read(nreadahead())
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    current = self.raw.read(to_read)
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self._peek_unlocked(size)
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    current = self.raw.read(to_read)
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    keep_conn_open = conn.communicate()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    self._conditional_error(req, '500 Internal Server Error')
    return self._sslobj.read(len, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)
    req.simple_response(response)

During handling of the above exception, another exception occurred:

  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
Traceback (most recent call last):
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    res = super().write(val, *args, **kwargs)
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    keep_conn_open = conn.communicate()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
    self._conditional_error(req, '500 Internal Server Error')
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
    return self._sock.send(b)
    req.simple_response(response)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    self.conn.wfile.write(EMPTY.join(buf))
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    res = super().write(val, *args, **kwargs)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
[08/Dec/2020:10:10:21] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

Exception in thread CP Server Thread-12:
Traceback (most recent call last):
[08/Dec/2020:10:10:21] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
Exception in thread CP Server Thread-13:
Traceback (most recent call last):
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    req.parse_request()
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    success = self.read_request_line()
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    data = self.rfile.readline(256)
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    b = self.read(nreadahead())
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self._sslobj.read(len, buffer)
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
    self.run()
    keep_conn_open = conn.communicate()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
    keep_conn_open = conn.communicate()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
    self._conditional_error(req, '500 Internal Server Error')
    self._conditional_error(req, '500 Internal Server Error')
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
    req.simple_response(response)
    req.simple_response(response)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
    self.conn.wfile.write(EMPTY.join(buf))
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    res = super().write(val, *args, **kwargs)
    res = super().write(val, *args, **kwargs)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    self._flush_unlocked()
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    return self._sock.send(b)
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    return self._sslobj.write(data)
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)
@sanderjo sanderjo added bug Something is broken triage labels Dec 8, 2020
@sanderjo sanderjo changed the title cherrypy SSL stops responding after 5 intermediate tracebacks TLSV1_ALERT_UNKNOWN_CA, and final "ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)" cherrypy SSL stops responding "ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)" (after 5 intermediate tracebacks TLSV1_ALERT_UNKNOWN_CA) Dec 8, 2020
@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 8, 2020

Also from the same Radarr 3.0.0 (but now with different client approach): different intermediate traceback SSLV3_ALERT_CERTIFICATE_UNKNOWN, and then the same ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471) and cherrypy/cheroot is still running but unreachable.

C:\mini-cherrypy>python mini-cherrypy-server.py
python version: 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
cherrpy version: 18.6.0
[08/Dec/2020:12:28:29] ENGINE Listening for SIGTERM.
[08/Dec/2020:12:28:29] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[08/Dec/2020:12:28:29] ENGINE Set handler for console events.
[08/Dec/2020:12:28:29] ENGINE Started monitor thread 'Autoreloader'.
[08/Dec/2020:12:28:29] ENGINE Serving on https://127.0.0.1:4400
[08/Dec/2020:12:28:29] ENGINE Bus STARTED
[08/Dec/2020:12:28:35] ENGINE socket.error 1
Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1273, in communicate
    req.parse_request()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 702, in parse_request
    success = self.read_request_line()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 300, in readline
    data = self.rfile.readline(256)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 559, in readline
    b = self.read(nreadahead())
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 538, in nreadahead
    readahead = self.peek(1)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1134, in peek
    return self._peek_unlocked(size)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\_pyio.py", line 1141, in _peek_unlocked
    current = self.raw.read(to_read)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:2621)
...
ssl.SSLError: [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] sslv3 alert certificate unknown (_ssl.c:2621)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    self.run()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\workers\threadpool.py", line 120, in run
    keep_conn_open = conn.communicate()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1302, in communicate
    self._conditional_error(req, '500 Internal Server Error')
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1345, in _conditional_error
    req.simple_response(response)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\server.py", line 1111, in simple_response
    self.conn.wfile.write(EMPTY.join(buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 438, in write
    res = super().write(val, *args, **kwargs)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 36, in write
    self._flush_unlocked()
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\site-packages\cheroot\makefile.py", line 45, in _flush_unlocked
    n = self.raw.write(bytes(self._write_buf))
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\socket.py", line 722, in write
    return self._sock.send(b)
  File "C:\Users\myname\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1173, in send
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)

@sanderjo sanderjo changed the title cherrypy SSL stops responding "ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)" (after 5 intermediate tracebacks TLSV1_ALERT_UNKNOWN_CA) cherrypy SSL stops responding "ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2471)" (after 5 intermediate tracebacks TLSV1_ALERT_UNKNOWN_CA or SSLV3_ALERT_CERTIFICATE_UNKNOWN) Dec 8, 2020
@webknjaz
Copy link
Member

webknjaz commented Dec 8, 2020

It sounds like your CherryPy app uses a self-signed certificate that is not added to Radarr's chain of trust. And so when Radarr doesn't confirm the received certificate as trusted, it issues a TLS alert that CherryPy-side (stdlib SSL module really) receives and raises as an exception, then it attempts to process that exception at a higher level, attempts responding with HTTP 500 and gets another exception while attempting to write on a closed transport.

@sanderjo @Safihre can you confirm that this is also happening under GNU/Linux? Can you confirm that it's a regression that doesn't happen before 8.4.5? I'm trying to understand if it's in any way related to the refactoring @liamstask has been working on lately.

Also, side note: in our TLS tests, we use trusted certificates. It sounds like we need to add tests with the untrusted certs too.

@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 8, 2020

It sounds like your CherryPy app uses a self-signed certificate that is not added to Radarr's chain of trust. And so when Radarr doesn't confirm the received certificate as trusted, it issues a TLS alert that CherryPy-side (stdlib SSL module really) receives and raises as an exception, then it attempts to process that exception at a higher level, attempts responding with HTTP 500 and gets another exception while attempting to write on a closed transport.

Sounds like an explanation!

@sanderjo @Safihre can you confirm that this is also happening under GNU/Linux?

So far: all on Linux, Radarr in a docker (sudo docker run -p 7878:7878 linuxserver/radarr) talking to mini-cherrypy cannot trigger the problem.
I'll do cross-testing between Linux and Windows.

Can you confirm that it's a regression that doesn't happen before 8.4.5?

I'll try to install that version via pip (on Windows)

Also, side note: in our TLS tests, we use trusted certificates. It sounds like we need to add tests with the untrusted certs too.

Yes, please!

@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 8, 2020

Cross-testing between Linux and Windows:

Radarr (in docker) on Linux ... connecting to cheroot-mini-server on Windows ... No SSL errors! That is weird. That means Radarr-on-Linux behaves differently than Radarr-on-Windows?

The other way around:

Radarr on Windows ... connecting to cheroot-mini-server on Linux ... errors on Linux!

sander@witte2004:~/mini-cherrypy$ python3 mini-cherrypy-server.py 
python version: 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0]
cherrpy version: 18.6.0
[08/Dec/2020:19:56:58] ENGINE Listening for SIGTERM.
[08/Dec/2020:19:56:58] ENGINE Listening for SIGHUP.
[08/Dec/2020:19:56:58] ENGINE Listening for SIGUSR1.
[08/Dec/2020:19:56:58] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[08/Dec/2020:19:56:58] ENGINE Started monitor thread 'Autoreloader'.
[08/Dec/2020:19:56:58] ENGINE Serving on https://0.0.0.0:4400
[08/Dec/2020:19:56:58] ENGINE Bus STARTED
[08/Dec/2020:19:57:31] ENGINE socket.error 1
Traceback (most recent call last):
  File "/home/sander/.local/lib/python3.8/site-packages/cheroot/server.py", line 1274, in communicate
    req.parse_request()
  File "/home/sander/.local/lib/python3.8/site-packages/cheroot/server.py", line 703, in parse_request
...
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2472)

@sanderjo
Copy link
Contributor Author

sanderjo commented Dec 8, 2020

On Linux, in a env, I'm able to install cheroot 8.4.4.

From Windows I connect to that Linux instance, and ... SSL errors. So 8.4.4 does not solve it.

EDIT
Same problems with much older versions:
cherrpy version: 18.1.1
cheroot version: 8.3.0
/EDIT

(env) sander@witte2004:~/mini-cherrypy$ ./mini-cherrypy-server.py 
python version: 3.8.5 (default, Jul 28 2020, 12:59:40) 
[GCC 9.3.0]
cherrpy version: 18.6.0
cheroot version: 8.4.4
[08/Dec/2020:20:27:33] ENGINE Listening for SIGTERM.
[08/Dec/2020:20:27:33] ENGINE Listening for SIGHUP.
[08/Dec/2020:20:27:33] ENGINE Listening for SIGUSR1.
[08/Dec/2020:20:27:33] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[08/Dec/2020:20:27:33] ENGINE Started monitor thread 'Autoreloader'.
[08/Dec/2020:20:27:33] ENGINE Serving on https://0.0.0.0:4400
[08/Dec/2020:20:27:33] ENGINE Bus STARTED
[08/Dec/2020:20:28:09] ENGINE socket.error 1
Traceback (most recent call last):
  File "/home/sander/env/lib/python3.8/site-packages/cheroot/server.py", line 1271, in communicate
    req.parse_request()
  File "/home/sander/env/lib/python3.8/site-packages/cheroot/server.py", line 702, in parse_request
    success = self.read_request_line()
  File "/home/sander/env/lib/python3.8/site-packages/cheroot/server.py", line 743, in read_request_line
    request_line = self.rfile.readline()
  File "/home/sander/env/lib/python3.8/site-packages/cheroot/server.py", line 300, in readline

...
    return self._sock.send(b)
  File "/usr/lib/python3.8/ssl.py", line 1173, in send
    return self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:2472)



@mpf82
Copy link

mpf82 commented Jan 12, 2021

Since upgrading from cheroot 8.4.6 to 8.5.1 we're also experiencing the same (or at least a very similar) issue both under Linux (SLES15 64bit) and Windows (10 64bit).

We've encounterd both

ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:2508)

and

ssl.SSLError: [SSL: SSLV3_ALERT_BAD_CERTIFICATE] sslv3 alert bad certificate (_ssl.c:1076)

We also noticed that Firefox (84.0.2 (64-Bit)) was more likely to display the page anyway, while accessing the page with Chrome ( 81.0.4044.92) would request a bunch of resources before the server would stop responding alltogether (w/o error) and just "hang" - no other requests (no matter from which browser) would be served after the sever hangs.

Downgrading to 8.4.8 resolved the issue for now.

We're using Python 3.7.5 64 bit and CherryPy 18.6.0

@mpf82
Copy link

mpf82 commented Jan 18, 2021

The hotfix released as 8.5.2 seems to fix the issue, at least AFAICT (using the code provided by sanderjo in this issue's first post as well as using the new fix in our application).

While with version 8.5.1 FF would sometimes raise an error and Chrome would hang after 5 to10 requests, with 8.5.2 I can see neither errors nor does the application hang after over 100 requests.

Cheers =)

webknjaz added a commit that referenced this issue Mar 31, 2024
A DoS would happen in many situations, including TLS errors and
attempts to close the underlying sockets erroring out.

This patch aims to prevent a situation when the worker threads are
killed by arbitrary exceptions that bubble up to their entry point
layers that aren't handled properly or at all.

PR #649

Fixes #358
Fixes #354

Ref #310
Ref #346
Ref #375
Ref #599
Ref #641

Resolves #365
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

No branches or pull requests

3 participants