Skip to content

[Bug] CI test job can hang for hours after tests stop producing output #323

Description

@404-Page-Found

Summary

The GitHub Actions test job can remain in npm test for roughly six hours and then be cancelled, even though the test suite itself can complete successfully in under a minute.

Observed behavior

The hang is not Ubuntu-specific. Recent CI history shows the same long-running npm test behavior on multiple runners, with successful runs on the other platforms.

Examples:

For the cancelled jobs, the logs end with patterns such as:

The operation was canceled.
Cleaning up orphan processes
Terminate orphan process: pid (...) (npm test)
Terminate orphan process: pid (...) (sh)
Terminate orphan process: pid (...) (MainThread)
...

On macOS, the cleanup also shows orphan node processes being terminated.

The runner therefore still had the npm test process and child processes alive when the job was cancelled.

By comparison, a successful Ubuntu run completed:

tests 441
pass 441
fail 0
cancelled 0
skipped 0
duration_ms 38389.531839

Reproduction / characteristics

The CI workflow runs the same test command on Ubuntu, macOS, and Windows:

npm run build && node --test "tests/**/*.test.mjs"

The test suite contains multiple E2E tests that spawn the CLI as child Node processes and create local HTTP servers.

The hang appears to be intermittent and platform-dependent in manifestation, but cross-platform in scope: different runs can hang on different runners, while the other runners complete normally.

This points more toward a test-process lifecycle / resource cleanup issue (for example lingering child processes, servers, sockets, or timers) than an Ubuntu-only runner problem.

Expected behavior

After all tests have completed, the npm test process should terminate normally and the GitHub Actions job should finish promptly on every supported runner.

Impact

This can consume the full GitHub Actions job execution window before the run is cancelled, making CI appear hung and significantly delaying feedback.

Environment

  • GitHub Actions
  • ubuntu-latest, macos-latest, and windows-latest
  • Node.js 24 (configured by the workflow)
  • node:test
  • 441-test suite on the observed successful run

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingcip2Medium priority; affects normal use

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions