Fix cluster not responding after restart
Two bugs prevented the cluster from working after a stop/start cycle: 1. tcp_listen_tcp() and tcp_listen_tls() had reuse_addr set to false, causing bind() to fail with EADDRINUSE when ports are in TIME_WAIT state after a restart. Set SO_REUSEADDR to true. 2. The vsr_boot_marker file (created in CWD on first boot) was never cleaned up on cluster stop. On restart, all nodes would enter STATUS_RECOVERY, but since RECOVERY messages are only processed by nodes in STATUS_NORMAL, the entire cluster would deadlock with no node able to recover. Remove the marker in cluster.sh stop. https://claude.ai/code/session_01U72omHJrk95xFwm22Rkqgt
This commit is contained in:
@@ -138,6 +138,7 @@ do_stop() {
|
||||
stop_process "node1"
|
||||
stop_process "node2"
|
||||
stop_process "node3"
|
||||
rm -f "$SCRIPT_DIR/vsr_boot_marker"
|
||||
echo "Cluster stopped."
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ int tcp_listen_tcp(TCP *tcp, Address addr)
|
||||
return -1;
|
||||
|
||||
// TODO: Make these configurable
|
||||
bool reuse_addr = false;
|
||||
bool reuse_addr = true;
|
||||
int backlog = 32;
|
||||
|
||||
SOCKET fd = create_listen_socket(addr, reuse_addr, backlog);
|
||||
@@ -302,7 +302,7 @@ int tcp_listen_tls(TCP *tcp, Address addr, string cert_file, string key_file)
|
||||
return -1;
|
||||
|
||||
// TODO: Make these configurable
|
||||
bool reuse_addr = false;
|
||||
bool reuse_addr = true;
|
||||
int backlog = 32;
|
||||
|
||||
SOCKET fd = create_listen_socket(addr, reuse_addr, backlog);
|
||||
|
||||
Reference in New Issue
Block a user