-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Milestone
Description
- Version: master (eeb5702)
- Platform: Linux
- Subsystem: streams
Try out the following test case with a fast readable stream, and a slow writable one that are piped together. There seems to be a bug in master where the readable one is not backpressured properly when multiple pushes are done in the read fn.
var stream = require('stream')
var rs = stream.Readable({
read: function () {
this.push(Buffer.alloc(65500))
for (var i = 0; i < 40; i++) {
this.push(Buffer.alloc(1024))
}
}
})
var ws = stream.Writable({
write: function (data, enc, cb) {
setTimeout(cb, 10)
}
})
setInterval(function () {
const state = rs._readableState
console.log('state.length %d, state.buffer.length %d, state.hwm %d', state.length, state.buffer.length, state.highWaterMark)
}, 1000)
rs.pipe(ws)Notice how the internal buffer just keeps growing
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.