-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Piping from stdin is broken #5927
Comments
Btw, apparently this only happens with pipes, i.e. $ head -c 256000 /dev/zero > data
$ ./node -e 'process.stdin.pipe(process.stdout)' < data | wc
0 0 256000 works just fine. |
cc @nodejs/streams |
Why it only happens with pipes probably has something to do with what I just posted in #5916 (comment):
|
@Fishrock123 Makes sense then, thanks for the info! |
I will definitely follow up and investigate this, but it might take me a while to fix it.. streams is delicate code, and I am travelling to the VM summit in SF next week. I might end up reverting #5776 while I figure it out, as it seems that this issue is more severe. Of course, if anyone wants to investigate further please be welcome! As a first step I'd like to see if reverting 4611389 (but not ace1009) makes this problem go away or not. |
This reverts commit 4611389. The offending commit broke certain usages of piping from stdin. Fixes: nodejs#5927 PR-URL: nodejs#5947 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Alexis Campailla <orangemocha@nodejs.org> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@evanlucas Thanks for taking care of this for now. Would it be a good idea if I tried to write a regression test for this? |
@addaleax That would definitely be appreciated! |
@evanlucas Done: #5949 |
Check that piping a large chunk of data from `process.stdin` into `process.stdout` does not lose any data by verifying that the output has the same size as the input. This is a regression test for nodejs#5927 and fails for the commits in the range [ace1009..89abe86).
Check that piping a large chunk of data from `process.stdin` into `process.stdout` does not lose any data by verifying that the output has the same size as the input. This is a regression test for #5927 and fails for the commits in the range [ace1009..89abe86). PR-URL: #5949 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Check that piping a large chunk of data from `process.stdin` into `process.stdout` does not lose any data by verifying that the output has the same size as the input. This is a regression test for #5927 and fails for the commits in the range [ace1009..89abe86). PR-URL: #5949 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Check that piping a large chunk of data from `process.stdin` into `process.stdout` does not lose any data by verifying that the output has the same size as the input. This is a regression test for #5927 and fails for the commits in the range [ace1009..89abe86). PR-URL: #5949 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@orangemocha I've tried reapplying ace1009 to master and running CI to see if the suite passes on windows https://ci.nodejs.org/job/node-test-commit/2887/ edit: no bueno |
Check that piping a large chunk of data from `process.stdin` into `process.stdout` does not lose any data by verifying that the output has the same size as the input. This is a regression test for #5927 and fails for the commits in the range [ace1009..89abe86). PR-URL: #5949 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Thanks @thealphanerd . I am investigating again, teaming up with @joaocgreis and @bzoz, and we have also confirmed that emitting 'pause' on nextTick alone causes this issue. This is unfortunate, because in some of my testing to fix #5384 I could see 'pause' and 'resume' events being emitted out of order. I have a bad feeling that there might be another set of hidden bugs in Node because of that, but that they are not getting caught by our unit tests. |
Rename the tests appropriately alongside mentioning the subsystem Also, make a few basic changes to make sure the tests conform to the standard test structure - Rename test-regress-nodejsGH-9819 to test-crypto-tostring-segfault - Rename test-regress-nodejsGH-5051 to test-http-addrequest-localaddress - Rename test-regress-nodejsGH-5727 to test-net-listen-invalid-port - Rename test-regress-nodejsGH-5927 to test-tty-stdin-pipe - Rename test-regress-nodejsGH-6235 to test-v8-global-setter Refs: nodejs#19105 Refs: https://github.com/nodejs/node/blob/master/doc/guides/writing-tests.md#test-structure
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the tests conform to the standard test structure. - Rename test-regress-GH-9819 to test-crypto-tostring-segfault - Rename test-regress-GH-5051 to test-http-addrequest-localaddress - Rename test-regress-GH-5727 to test-net-listen-invalid-port - Rename test-regress-GH-5927 to test-tty-stdin-pipe - Rename test-regress-GH-6235 to test-v8-global-setter PR-URL: #19275 Refs: #19105 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the tests conform to the standard test structure. - Rename test-regress-GH-9819 to test-crypto-tostring-segfault - Rename test-regress-GH-5051 to test-http-addrequest-localaddress - Rename test-regress-GH-5727 to test-net-listen-invalid-port - Rename test-regress-GH-5927 to test-tty-stdin-pipe - Rename test-regress-GH-6235 to test-v8-global-setter PR-URL: #19275 Refs: #19105 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the tests conform to the standard test structure. - Rename test-regress-GH-9819 to test-crypto-tostring-segfault - Rename test-regress-GH-5051 to test-http-addrequest-localaddress - Rename test-regress-GH-5727 to test-net-listen-invalid-port - Rename test-regress-GH-5927 to test-tty-stdin-pipe - Rename test-regress-GH-6235 to test-v8-global-setter PR-URL: #19275 Refs: #19105 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the tests conform to the standard test structure. - Rename test-regress-nodejsGH-9819 to test-crypto-tostring-segfault - Rename test-regress-nodejsGH-5051 to test-http-addrequest-localaddress - Rename test-regress-nodejsGH-5727 to test-net-listen-invalid-port - Rename test-regress-nodejsGH-5927 to test-tty-stdin-pipe - Rename test-regress-nodejsGH-6235 to test-v8-global-setter PR-URL: nodejs#19275 Refs: nodejs#19105 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Since ace1009 (#5776), stdin is truncated to the first 64kb when piped to some other stream.
Before:
After:
This also goes for piping to
bl()
, and theend
event onprocess.stdin
seems to be fired only when the input is smaller than 16384 bytes./cc @orangemocha
The text was updated successfully, but these errors were encountered: