Skip to content

Report a crashed backend instead of a wall of connection failures - #100

Merged
markccchiang merged 15 commits into
devfrom
mark/fix_issue_97
Sep 1, 2026
Merged

Report a crashed backend instead of a wall of connection failures#100
markccchiang merged 15 commits into
devfrom
mark/fix_issue_97

Conversation

@markccchiang

Copy link
Copy Markdown
Collaborator

Description

Fixes #97. Each ICD stage runs the files in its .tests list, one per npm test, against a single long-lived backend. If that backend dies partway through, every remaining file reports a connection failure, and nothing in the log says the backend is gone, which file killed it, or what it said on the way out, so the failure you read is the one place the problem is not.

This branch makes readiness a property of the port rather than of the process, restarts a backend that dies mid-stage, reports crashes and skipped files separately from real test failures, and points the workflows at the actions in this repository so that any of it actually runs.

Changes

Three scripts hold the harness, and both actions call them:

  • wait_for_backend.sh: readiness is a property of the port, asked with bash's own /dev/tcp rather than pgrep. 120 s before the first test, one immediate check after every test file, and the tail of the backend log on failure.
  • start_backend.sh: one copy of the launch command line, so a stage can bring a crashed backend back with the invocation it was started with. Clears the port first.
  • run_test_stage.sh: the stage loop, once, instead of one copy per action. Restarts a crashed backend up to 3 times, retries a failed file once, and reports crash sites, retried passes, skipped files, and real failures as four separate lists. A crash fails the stage even if everything that ran passed.

Around them:

  • The three workflows now use ./ICD-RxJS/.github/actions/, which is what makes any of the above.
  • The backend is matched by its --port argument rather than by any mention of carta_backend and the port, which had matched (and killed) the Apptainer process running the stage itself.
  • The macOS port comes from matrix.port on both sides, as it already did on Linux, instead of from two literals that had to agree.
  • Stage jobs get 10 minutes rather than 5, so a crash has time to be reported.

Restarting is safe because the tests hold no state in the backend: every file opens its own connection and loads its own images, and each npm test is a separate Jest process.

Checklist

For the pull request:

  • Documentation has been updated (or no documentation changes are needed)

pgrep matches as soon as carta_backend forks, which is well before it
binds the port, and `pgrep ... | head -n 1` reports head's exit status,
so a backend which died on startup still looked like a success. The
macOS action ran `pgrep carta_backend` after each test file but only
printed the result. Neither action could tell a dead backend from a
failing test.

Connect to the port instead, which is the only check that answers the
question the tests ask, using bash's own /dev/tcp so no container needs
a tool it may not have. Wait up to 120 s for it before the stage starts,
and probe again after each test file: a backend which dies part way
through takes every remaining file with it, each reporting a connection
failure rather than the crash which caused it. The stage now names the
file it died on and tails the backend log where it failed, instead of
leaving the reason in an uploaded artifact.

@pshnghng0318 pshnghng0318 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good.

This PR allows the ICD tests to check test failures and backend crashes independently.

If the backend crashes, it can be restarted to continue running the remaining tests.

@markccchiang
markccchiang merged commit a8624fb into dev Sep 1, 2026
109 of 113 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI hides crashed backends, and on Linux all but the last file of a stage

2 participants