| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@mcollina build started: https://ci.nodejs.org/blue/organizations/jenkins/node-test-pull-request-lite-pipeline/detail/node-test-pull-request-lite-pipeline/472/pipeline |
Sorry, something went wrong.
|
This is an alternative implementation of #21696. |
Sorry, something went wrong.
Sorry, something went wrong.
|
It seems like this one has the same flaws my PR had at the beginning
But the first one is documented now. |
Sorry, something went wrong.
That works exactly as expected. If resume() is ignored, why pause() shouldn't?
Which is as expected. on('readable') is a method of consuming data from a stream with backpressure, so a user has to consume it via stream.read() calls. Side note, without #18994 stream.read() always returned null when used with stream.pipe(). |
Sorry, something went wrong.
|
Yeah, this may be better as it simplifies the implementation a bit and signifies the fact that you shouldn't use 'readable' with 'data'. But as I said we have to better document it as issues of incorrect usage of streams are constantly popping up. |
Sorry, something went wrong.
|
I'll add some more docs for review tomorrow. |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
[`readable.read()`][]-> [`readable.read()`][stream-read]?
Sorry, something went wrong.
There was a problem hiding this comment.
[`data`][] -> [`'data'`][]?
Sorry, something went wrong.
|
CITGM seems ok. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Doc part LGTM. |
Sorry, something went wrong.
Sorry, something went wrong.
|
@mcollina I think this relates to #21122. What if we don't call read() inside the callback of 'readable' ? This might be regarded as an undefined behavior but calling on('data') before on('readable') like below: const fs = require('fs')
const { resolve } = require('path')
const source = resolve(__dirname, 'index.js')
const target = resolve(__dirname, 'copy.js')
const reader = fs.createReadStream(source)
const writer = fs.createWriteStream(target);
reader.on('close', () => {
console.log('reader closed');
});
writer.on('close', () => {
console.log('writer closed');
});
reader.on('data', () => {
console.log('receive data')
})
reader.on('readable', () => {
// DO NOT `reader.read()`
})Will print: receive data reader closed However, change the order of binding these two events will result in different behaviors: const fs = require('fs')
const { resolve } = require('path')
const source = resolve(__dirname, 'index.js')
const target = resolve(__dirname, 'copy.js')
const reader = fs.createReadStream(source)
const writer = fs.createWriteStream(target);
reader.on('close', () => {
console.log('reader closed');
});
writer.on('close', () => {
console.log('writer closed');
});
reader.on('readable', () => {
// DO NOT `reader.read()`
})
reader.on('data', () => {
console.log('receive data')
})Will print nothing and exit. Also, replace reader.on('data') with reader.pipe(writer) will cause similar results. |
Sorry, something went wrong.
|
I see, thanks. |
Sorry, something went wrong.
Sorry, something went wrong.
|
LGTM, nice fix |
Sorry, something went wrong.
Sorry, something went wrong.
|
@nodejs/build I can't get centos7-64-gcc6 to pass, see https://ci.nodejs.org/job/node-test-commit-linux/20945/nodes=centos7-64-gcc6/console. This looks like an infra issue, see nodejs/build#1468. |
Sorry, something went wrong.
|
Resume Build: https://ci.nodejs.org/job/node-test-pull-request/16665/ |
Sorry, something went wrong.
Fixes: nodejs#21398 See: nodejs#21696 PR-URL: nodejs#22209 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Mathias Buus <mathiasbuus@gmail.com>
|
Resume Build resulted in a green CI run. Landed in 98cf84f. |
Sorry, something went wrong.
Fixes test failure causes by combination of nodejs/node#22209 and an ambiguous test.
Fixes test failure causes by combination of nodejs/node#22209 and an ambiguous test.
Fixes test failure causes by combination of nodejs/node#22209 and an ambiguous test.
Fixes test failure causes by combination of nodejs/node#22209 and an ambiguous test.
| Back | FazBrowse Home | New Git URL |
In #18994, we made 'readable' take precedence over 'data'/resume() and pause(). However, we didn't take into account situation where both 'readable' and 'data' event handler were present at the same time. This PR addresses it by starting flowing after 'readable' is removed.
Fixes: #21398
Checklist