Skip to content

fix: defer unpause in setDataStream to prevent hang on Linux#448

Open
JCMais wants to merge 1 commit intodevelopfrom
fix/mime-stream-unpause-hang
Open

fix: defer unpause in setDataStream to prevent hang on Linux#448
JCMais wants to merge 1 commit intodevelopfrom
fix/mime-stream-unpause-hang

Conversation

@JCMais
Copy link
Copy Markdown
Owner

@JCMais JCMais commented Apr 12, 2026

Summary

  • setDataStream called the unpause callback synchronously from stream event handlers (readable, end, error), which could invoke curl_easy_pause() while libcurl was still processing the READFUNC_PAUSE return from the read callback
  • This reentrant call caused hangs on Linux (observed as a 60s timeout in CurlMime.spec.ts > should handle basic stream upload)
  • Fixed by deferring unpause to the next event loop tick via setImmediate and tracking pause state, matching the pattern already used by setUploadStream in Curl.ts

Test plan

  • Existing test CurlMime.spec.ts > should handle basic stream upload should pass on Linux instead of timing out

The readable/end/error event handlers called unpause() synchronously,
which could invoke curl_easy_pause() while libcurl was still processing
the READFUNC_PAUSE return from the read callback. This reentrant call
caused hangs on Linux.

Defer the unpause to the next event loop tick via setImmediate, matching
the pattern used by setUploadStream in Curl.ts.
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