Skip to content

ngprism: don't exit on a failed heartbeat under Windows - #315

Merged
davexparker merged 1 commit into
prismmodelchecker:masterfrom
davexparker:ngprism-win-heartbeat
Nov 6, 2026
Merged

davexparker merged 1 commit into
prismmodelchecker:masterfrom
davexparker:ngprism-win-heartbeat

Conversation

@davexparker

Copy link
Copy Markdown
Member

Fixes an intermittent failure of the Windows CI jobs, where make tests aborts with Failure: 0 and a send: No error line in the log, e.g. this run (ctmc-until.sm) and this one (brp_int.prism).

Cause: on Windows, ngprism sends heartbeats from a separate thread, every 500ms. One can fail just as a run ends, and the client then exits with an error even though the run succeeded. prism-auto stops at any non-zero exit code, so the whole test run is abandoned.

sendChunk already tries to ignore such failures, but it checks for errno == EPIPE. Winsock doesn't set errno (which is also why the message is "No error"), so the check never applies on Windows.

Fix: on Windows, ignore any failed heartbeat. The main thread still gets the real exit code from the server, or sees a failed recv() if the server has really gone. Other platforms send heartbeats from the main loop and are unchanged: the preprocessed source is identical on macOS.

Testing: the Windows code has not been compiled locally, so this PR's CI is its first build. The failure is rare (2 of the last 12 failed runs), so one green run shows that it builds and passes but doesn't prove the race has gone. The diagnosis comes from the code and logs: the failure hasn't been reproduced, and the actual Winsock error wasn't recorded.

Heartbeats are sent from a separate thread on Windows, so one can fail
just as the server finishes a run. This made the client exit with an
error, despite the run having succeeded, which aborts prism-auto.

A check to ignore such failures was already present, but it relied on
errno being EPIPE, and Winsock does not set errno.
@davexparker
davexparker merged commit ae02eab into prismmodelchecker:master Nov 6, 2026
7 checks passed
@davexparker
davexparker deleted the ngprism-win-heartbeat branch November 6, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant