doc: Piping multiple streams to the same Writable stream might not end

📗 API Reference Docs Problem

  • Version: 15.4.0
  • Platform: Linux pop-os 5.8.0-7630-generic 20.10~61c3910-Ubuntu SMP Thu Nov 26 00:10:35 UTC x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: stream

Location

Section of the site where the content exists

Affected URL(s):

Description

Concise explanation of the problem

The documentation for readable.pipe() reads:

... The flow of data will be automatically managed so that the destination Writable stream is not overwhelmed by a faster Readable stream.

So when we open a Writable stream and then pipe multiple Readable streams into this Writable stream; the stream becomes full/congested and needs to drain but then we pipe more Readable streams into this stream. This seems to sometimes cause a Readable stream to not end and thus does not pipe its data to the Writable stream.

Bug in electron/asar explaining the issue electron/asar#210.

Since electron/asar does this in basically a for await-loop, we get stuck waiting for a Readable stream which never ends.

Is this expected behavior when piping multiple Readable streams into one Writable stream? Should one check writable.writableNeedDrain before piping a Readable stream?


  • I would like to work on this issue and
    submit a pull request.