Skip to content

Commit bb6694d

Browse files
committed
fix(capabilities): unref the wasm transport sleep timer so the host can exit
The wasm exporter races a sleep(timeout) against each HTTP request as a timeout guard (and reuses it for retry backoff). On a fast success the timer is abandoned but, being reffed, kept the Node process alive for up to the request timeout (5 minutes) after the last flush. unref the timer: an in-flight request refs the event loop on its own, so an abandoned/standalone timeout timer must not block process exit. Also fixes the CI test matrix for the wasm pipeline: - scripts/test.sh probes for --test-force-exit (Node >= 20.14/22) and runs without it on Node 18, which rejects the flag. - test/pipeline.js is skipped on Node 18: it needs --test-force-exit (the wasm exporter keeps the loop alive) and the wasm HTTP client leaves a mock-agent socket open that node:test cannot drain there. The pipeline wasm is fully covered by the build-test-wasm job and the Node 20/22/24/26 runs, so this loses no real coverage (it is platform/Node-independent wasm).
1 parent 0857256 commit bb6694d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

scripts/test.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ run_test() {
3232

3333
# Run top-level test files
3434
for f in test/*.js; do
35+
# pipeline.js's wasm exporter keeps the event loop alive after a flush, so it
36+
# needs --test-force-exit. Node 18 lacks that flag AND the wasm HTTP client
37+
# leaves a mock-agent socket open, so node:test cannot exit cleanly there. The
38+
# pipeline wasm is fully exercised by the build-test-wasm job and by the
39+
# Node 20/22/24/26 runs here, so skip it on a Node without --test-force-exit.
40+
if [ "$f" = "test/pipeline.js" ] && ! node --test-force-exit --eval '' >/dev/null 2>&1; then
41+
echo "Skipping $f (no --test-force-exit on this Node; covered by build-test-wasm + newer Node)"
42+
continue
43+
fi
3544
run_test "$f"
3645
done
3746

0 commit comments

Comments
 (0)