summaryrefslogtreecommitdiff
path: root/9ns/test/adv_bridge_interrupt.sh
diff options
context:
space:
mode:
Diffstat (limited to '9ns/test/adv_bridge_interrupt.sh')
-rwxr-xr-x9ns/test/adv_bridge_interrupt.sh26
1 files changed, 14 insertions, 12 deletions
diff --git a/9ns/test/adv_bridge_interrupt.sh b/9ns/test/adv_bridge_interrupt.sh
index e364143..ba76f78 100755
--- a/9ns/test/adv_bridge_interrupt.sh
+++ b/9ns/test/adv_bridge_interrupt.sh
@@ -118,18 +118,20 @@ expect_eq "never_flush/cache0: reader killed" "124" "$(field rc "$OUT")"
fids_same "never_flush/cache0"
bridge_fids_same "never_flush/cache0"
-echo "# (b) a server that ignores Tflush too: the reader stays blocked, SIGTERM to 9ns still ends the session"
-start_server never
-timeout -s TERM 3 "$NS" --unix "$SOCK" --mount "$M" -- sh -c "timeout -s INT 1 cat $M/f; echo unreachable-rc=\$?" >"$TMP/never.out" 2>"$TMP/never.err" &
-TPID=$!
-sleep 4
-if kill -0 "$TPID" 2>/dev/null; then
- fail "never: SIGTERM did not end 9ns while the reader was stuck"; kill -9 "$TPID"
-else
- pass "never: SIGTERM ends 9ns even though the server ignores the Tflush"
-fi
-wait "$TPID" 2>/dev/null
-expect_eq "never: the reader never came back (server ignores Tflush)" "" "$(grep unreachable "$TMP/never.out")"
+echo "# (b) a server that ignores Tflush too: the reader comes back after the flush grace, and the session is gone with it"
+# `never` stops reading once the Tread hangs, so the Tflush is never even
+# seen. The protocol says wait for the Rflush; a server that has not managed
+# one in 3s (nine.Session.flush_grace_ms) is not going to, and the reader
+# behind the interrupt is unkillable until we stop waiting. So the read fails
+# EINTR after the grace, the session is wedged, and 9ns ends the mount: the
+# next access answers ENOTCONN instead of parking another process forever.
+run never "$(timed "timeout -s INT 1 cat $M/f"); cat $M/d/g 2>&1; echo after-rc=\$?"
+no_crash "never/grace"
+expect_eq "never/grace: reader killed by the signal (124)" "124" "$(field rc "$OUT")"
+NEVER_MS=$(field ms "$OUT")
+if [ "$NEVER_MS" -ge 3500 ] && [ "$NEVER_MS" -lt 9000 ]; then pass "never/grace: released after the 3s flush grace (${NEVER_MS}ms)"; else fail "never/grace: release time out of range" "ms=$NEVER_MS (expected 3500..9000)"; fi
+expect_eq "never/grace: the mount is gone afterwards (not a hang)" "after-rc=1" "$(printf '%s\n' "$OUT" | grep '^after-rc=')"
+expect_contains "never/grace: 9ns reports the closed session" "connection closed" "$STDERR"
echo
echo "passed=$PASSED failed=$FAILED"