Skip to content

Commit 6ab5e3f

Browse files
committed
fix(smoke): retire the account daemon before the harness ends
The account daemon legitimately outlives its last client for a moment while it drains, holding its log and config DB open. POSIX rm does not care, but on Windows an open file blocks deletion, so the caller's cleanup of the smoke cache raced the daemon's asynchronous shutdown and failed with "Device or resource busy" after every phase had passed — first visible on windows-latest once the agent-config phases stopped failing earlier, and reproduced identically on the local Windows VM. The smoke now ends with an explicit phase: stop the daemon through its own lifecycle command, wait (bounded) until status reports not-running, and give Windows one beat for the final handle close. A daemon that will not retire is now a smoke FAILURE in its own right instead of a cleanup accident. Verified red-to-green on the VM and green on macOS. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent ece838c commit 6ab5e3f

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎scripts/smoke-test.sh‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3238,5 +3238,27 @@ fi
32383238
wait "$SHUT_SRV_PID" 2>/dev/null || true
32393239
echo "OK 16: stdio server terminated after stdin closed, no orphan"
32403240

3241+
# The account daemon legitimately outlives its last client for a moment while
3242+
# it drains, holding its log and config DB open. POSIX rm doesn't care, but on
3243+
# Windows an open file blocks deletion — so a caller's cleanup rm of the smoke
3244+
# cache races the daemon's asynchronous shutdown and fails with "Device or
3245+
# resource busy". Retire the daemon deterministically through its own
3246+
# lifecycle command and wait (bounded) until it reports not-running, then give
3247+
# Windows one beat for the final handle close.
3248+
"$BINARY" daemon stop >/dev/null 2>&1 || true
3249+
DAEMON_GONE=0
3250+
for _ in $(seq 1 100); do # bounded ~20s (100 × 0.2s)
3251+
if ! "$BINARY" daemon status >/dev/null 2>&1; then DAEMON_GONE=1; break; fi
3252+
sleep 0.2
3253+
done
3254+
if [ "$DAEMON_GONE" -ne 1 ]; then
3255+
echo "FAIL 17: account daemon still active after daemon stop"
3256+
exit 1
3257+
fi
3258+
if [[ "$BINARY" == *.exe ]]; then
3259+
sleep 1
3260+
fi
3261+
echo "OK 17: account daemon retired; smoke cache is deletable"
3262+
32413263
echo ""
32423264
echo "=== smoke-test: ALL PASSED ==="

0 commit comments

Comments
 (0)