Skip to content

Commit

Permalink
WIP: eventlet: ssl.SSLZeroReturnError: TLS/SSL connection has been cl…
Browse files Browse the repository at this point in the history
…osed (EOF) (_ssl.c:992)
  • Loading branch information
pajod committed Sep 5, 2024
1 parent 27be287 commit f630304
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion gunicorn/workers/geventlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from functools import partial
import sys
import ssl

try:
import eventlet
Expand All @@ -19,6 +20,7 @@
import eventlet.wsgi
import greenlet

from gunicorn import util
from gunicorn.workers.base_async import AsyncWorker
from gunicorn.sock import ssl_wrap_socket

Expand Down Expand Up @@ -154,7 +156,17 @@ def timeout_ctx(self):

def handle(self, listener, client, addr):
if self.cfg.is_ssl:
client = ssl_wrap_socket(client, self.cfg)
try:
req = None
client = ssl_wrap_socket(client, self.cfg)
except ssl.SSLError as e:
if e.args[0] == ssl.SSL_ERROR_EOF:
self.log.debug("ssl connection closed")
else:
self.log.debug("Error processing SSL request.")
self.handle_error(req, client, addr, e)
util.close(client)
return
super().handle(listener, client, addr)

def run(self):
Expand Down

0 comments on commit f630304

Please sign in to comment.