Skip to content

fix(requester): keep non-stream timeout active after headers - #191

Open
lonr-6 wants to merge 2 commits into
liuw1535:mainfrom
lonr-6:fix/nonstream-header-timeout
Open

fix(requester): keep non-stream timeout active after headers#191
lonr-6 wants to merge 2 commits into
liuw1535:mainfrom
lonr-6:fix/nonstream-header-timeout

Conversation

@lonr-6

@lonr-6 lonr-6 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • keep the overall request watchdog active for non-stream responses after headers arrive
  • preserve the existing behavior for streaming responses, which intentionally clear the watchdog once streaming starts
  • make child-process spawning injectable for deterministic lifecycle tests
  • add a regression test for a child that emits response headers and then stalls forever

Root cause

FingerprintRequester.request() unconditionally cleared timeoutId as soon as it parsed \r\n\r\n. That is appropriate for long-lived streaming responses, but it also disabled the only JavaScript-side watchdog for normal requests. If the fingerprint child or upstream sent headers and then stopped producing a body without exiting, the Promise could remain pending indefinitely.

The timeout is now cleared after headers only when onDownloadProgress identifies the streaming path. Non-stream requests retain the watchdog until the child exits.

Verification

  • deterministic fake-child regression: headers are emitted, the body stalls, and the request rejects with ECONNABORTED instead of hanging
  • focused harness passed on Node.js 22
  • branch is based on current upstream main (849deac8)

Refs #159
Refs #175

@lonr-6
lonr-6 marked this pull request as ready for review August 18, 2026 09:29
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