Skip to content

Commit 18eaa2d

Browse files
wbarnhasibiryakov
andauthored
Handle OSError to properly recycle SSL connection, fix infinite loop (dpkp#155)
* handling OSError * better error output * removed traceback logging --------- Co-authored-by: Alexander Sibiryakov <[email protected]>
1 parent b1a4c53 commit 18eaa2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kafka/conn.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def _try_handshake(self):
510510
# old ssl in python2.6 will swallow all SSLErrors here...
511511
except (SSLWantReadError, SSLWantWriteError):
512512
pass
513-
except (SSLZeroReturnError, ConnectionError, TimeoutError, SSLEOFError):
513+
except (SSLZeroReturnError, ConnectionError, TimeoutError, SSLEOFError, ssl.SSLError, OSError) as e:
514514
log.warning('SSL connection closed by server during handshake.')
515515
self.close(Errors.KafkaConnectionError('SSL connection closed by server during handshake'))
516516
# Other SSLErrors will be raised to user

0 commit comments

Comments
 (0)