HarperFast / HarperFast/rocksdb-js
Bound and reap the commit-teardown test child when a native fixture hangs
- Dominant language
- C++
- Stars
- 21
- Forks
- 2
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 36
Description
`spawnRepro()` in `test/commit-teardown.test.ts` waits for the native child process to emit `close`, but installs no deadline and never kills it when the enclosing Vitest test times out. A deadlocked commit/teardown fixture therefore consumes the 120-second test timeout while the child can remain alive; captured stderr is printed only on child close, so the failure loses its most useful diagnostics.
Found during the #462 outside review; confirmed by source inspection against main `b4d104562e7d5353b6d7a4412e0a8b48ee805062`. No new native deadlock or observed orphaned CI process is claimed. The existing fixture already has potentially unbounded worker startup/termination/close waits, and the performance PR adds an awaited surviving-env commit, so this is relevant failure-path coverage for both versions.
Reproduction route for the harness: run `spawnRepro` against a child fixture that keeps a live timer and never exits (or inject a never-settling commit with a referenced event loop). Let the enclosing test time out. The parent should bound and terminate that child and include captured stderr in the rejection; the current helper only resolves on `child.on('close')` or rejects on `child.on('error')` and has no timeout path.
Suggested fix: give `spawnRepro` its own deadline shorter than the Vitest timeout, kill the child on expiry, wait for it to close, reject with stderr plus the selected commit mode, and clear the timer on every normal/error exit. A fixture-side timeout for the surviving commit can improve the specific diagnostic, but the parent deadline is still needed for a synchronous native deadlock. Test both normal exit and a deliberately hanging child.
Source: [spawnRepro](https://github.com/HarperFast/rocksdb-js/blob/b4d104562e7d5353b6d7a4412e0a8b48ee805062/test/commit-teardown.test.ts#L40).
Priority **P2**: contained test-infrastructure defect that can waste CI time and obscure native lifecycle failures; no production defect established. No matching subsystem epic or committed release was found, and there is no customer/security context. This differs from #859's empty worker-close promise array.
Contributor guide
Research direction
Start with spawnRepro in test/commit-teardown.test.ts and trace its child close, error, and enclosing-test timeout paths. Run the commit-teardown tests with both a normal child and a deliberately hanging child. Done means the parent deadline terminates and awaits the child, clears timers on every exit, and includes captured stderr and the selected commit mode in failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, node.js, typescript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100