What happened?
amber/src/main/python/core/runnables/heartbeat.py::Heartbeat._check_heartbeat wraps both socket.create_connection and the subsequent temp_socket.close() in a single try/except. If close() raises after a successful connect, the method logs "Server is down" and returns False even though the JVM is reachable. The double-check in run() masks transient cases but the misclassification can still trigger unwarranted shutdowns.
How to reproduce?
from unittest.mock import patch, MagicMock
from threading import Event
from core.runnables.heartbeat import Heartbeat
hb = Heartbeat("localhost", 12345, 0.1, Event())
sock = MagicMock()
sock.close.side_effect = OSError("close failed")
with patch("core.runnables.heartbeat.socket.create_connection", return_value=sock):
print(hb._check_heartbeat()) # False, log says "Server is down"
Version
1.1.0-incubating (Pre-release/Master)
What happened?
amber/src/main/python/core/runnables/heartbeat.py::Heartbeat._check_heartbeatwraps bothsocket.create_connectionand the subsequenttemp_socket.close()in a single try/except. Ifclose()raises after a successful connect, the method logs"Server is down"and returnsFalseeven though the JVM is reachable. The double-check inrun()masks transient cases but the misclassification can still trigger unwarranted shutdowns.How to reproduce?
Version
1.1.0-incubating (Pre-release/Master)