Skip to content

Commit

Permalink
Handle OSError to properly recycle SSL connection, fix infinite loop (#…
Browse files Browse the repository at this point in the history
…155)

* handling OSError

* better error output

* removed traceback logging

---------

Co-authored-by: Alexander Sibiryakov <[email protected]>
  • Loading branch information
wbarnha and sibiryakov authored Mar 10, 2024
1 parent b1a4c53 commit 18eaa2d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kafka/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def _try_handshake(self):
# old ssl in python2.6 will swallow all SSLErrors here...
except (SSLWantReadError, SSLWantWriteError):
pass
except (SSLZeroReturnError, ConnectionError, TimeoutError, SSLEOFError):
except (SSLZeroReturnError, ConnectionError, TimeoutError, SSLEOFError, ssl.SSLError, OSError) as e:
log.warning('SSL connection closed by server during handshake.')
self.close(Errors.KafkaConnectionError('SSL connection closed by server during handshake'))
# Other SSLErrors will be raised to user
Expand Down

0 comments on commit 18eaa2d

Please sign in to comment.