mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
The pipeTo() pump re-enters from the destination's ready hook, which writableStreamUpdateBackpressure invokes synchronously, and from the chunk steps of its read request. Both run in the async context of the code that cleared the backpressure or enqueued the chunk, so the source's pull() and the writes issued after a resumption observed that context instead of the one of the pipeTo() call, as they did with the promise-based pump. Capture the async context frame when the pipe starts and run the pump in it. Refs: https://github.com/nodejs/node/issues/66906 Refs: https://github.com/nodejs/node/pull/65138 Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/67054 Refs: https://github.com/nodejs/node/pull/67052 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>