reload_dshackle.sh: drop established gRPC connections after successful SIGHUP reload

Extend reload_dshackle.sh to drop established gateway gRPC connections on
port 2449 after a successful SIGHUP config reload, forcing the dRPC edge
to reconnect within ~1s and re-read the advertised chain/method list.
Gateways only re-initialize advertisements on reconnection (verified live:
0.03-0.06s serving gap, 33 re-probes in 4s). This allows deploy-time upstream
additions (new chains like mova, new backends like us-50) to be seen by
dRPC immediately rather than waiting for natural reconnection.

The TCP-level drop is best-effort: failure does NOT fail the script.
Operator ruling: this stays a TCP-level drop, NOT a dshackle code change.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
2026-08-27 03:14:47 +00:00
parent 37a26d8791
commit 81c9addac9

View File

@@ -51,7 +51,14 @@ for CID in $(docker ps -q -f "name=dshackle"); do
elif echo "$LOGS" | grep -qF "$DROP_MARK"; then elif echo "$LOGS" | grep -qF "$DROP_MARK"; then
REASON="concurrent HUP dropped (reload skipped)" REASON="concurrent HUP dropped (reload skipped)"
fi fi
[ -z "$REASON" ] && continue # SIGHUP applied the config — done [ -z "$REASON" ] && {
# Drop established gateway gRPC connections to force dRPC edge to reconnect
# and re-read the advertised chain/method list. Gateways only re-initialize
# advertisements on reconnection. Best-effort: failure does NOT fail the script.
PID=$(docker inspect -f '{{.State.Pid}}' "$CID" 2>/dev/null) && \
nsenter -t "$PID" -n ss -K state established '( sport = :2449 )' >/dev/null 2>&1
continue
}
echo "reload_dshackle: $NAME reload did NOT apply ($REASON) — restarting to load config fresh" >&2 echo "reload_dshackle: $NAME reload did NOT apply ($REASON) — restarting to load config fresh" >&2
if ! docker restart "$CID" >/dev/null 2>&1; then if ! docker restart "$CID" >/dev/null 2>&1; then
echo "reload_dshackle: ERROR: restart failed for $NAME — config NOT applied, manual intervention" >&2 echo "reload_dshackle: ERROR: restart failed for $NAME — config NOT applied, manual intervention" >&2