Skip to content

stream: do not unconditionally call `_read()` on `resume()`

Rodrigo Muino Tomonari requested to merge github/fork/addaleax/resume-read0 into master

readable.resume() calls .read(0), which in turn previously set needReadable = true, and so a subsequent .read() call would call _read() even though enough data was already available.

This can lead to elevated memory usage, because calling _read() when enough data is in the readable buffer means that backpressure is not being honoured.

Fixes: https://github.com/nodejs/node/issues/26957

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading