2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 00:05:15 +00:00

python-stream: Handle SSL error in do_handshake.

In some cases ovsdb server or relay gets restarted, ovsdb python clients
may keep the local socket open. Instead of reconnecting a lot of failures
will be logged.
This can be reproduced with ssl connections to the server/relay and
restarting it, so it has the same IP after restart.

This patch catches the Exceptions at do_handshake to recreate the
connection on the client side.

Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Stefan Hoffmann <stefan.hoffmann@cloudandheat.com>
Signed-off-by: Luca Czesla <luca.czesla@mail.schwarz>
Signed-off-by: Max Lamprecht <max.lamprecht@mail.schwarz>
Co-authored-by: Luca Czesla <luca.czesla@mail.schwarz>
Co-authored-by: Max Lamprecht <max.lamprecht@mail.schwarz>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Stefan Hoffmann
2023-04-21 10:29:36 +02:00
committed by Ilya Maximets
parent c3559dffcb
commit b456b1a02f

View File

@@ -824,7 +824,8 @@ class SSLStream(Stream):
self.socket.do_handshake()
except ssl.SSLWantReadError:
return errno.EAGAIN
except ssl.SSLSyscallError as e:
except (ssl.SSLSyscallError, ssl.SSLZeroReturnError,
ssl.SSLEOFError, OSError) as e:
return ovs.socket_util.get_exception_errno(e)
return 0