Repository navigation
Piping from stdin is broken #5927
Description
Activity
- addedstreamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.
on Mar 27, 2016 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):
<-ing a file into stdin actually results in afs.ReadStream, rather an atty.ReadStream, and as such does not inherit fromnet.Socket, unlike the other possiblestdinoptions:node/lib/internal/process/stdio.js
Lines 54 to 57 in 293fd04
case 'FILE': var fs = require('fs'); stdin = new fs.ReadStream(null, { fd: fd, autoClose: false }); break; @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.
Reacted by Anna Henningsen- added a commit that references this issue
on Mar 29, 2016 7 remaining items
- added a commit that references this issue
on Mar 31, 2016 @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
- added a commit that references this issue
on Apr 11, 2016 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.
- added a commit that references this issue
on Mar 13, 2018 - added 2 commits that reference this issue
on Mar 20, 2018 - added a commit that references this issue
on May 8, 2018
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 theendevent onprocess.stdinseems to be fired only when the input is smaller than 16384 bytes./cc @orangemocha