Skip to content
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

Node.js freezes on stdin buffer larger than 163840 bytes #3307

Closed
zanona opened this issue Jun 16, 2018 · 3 comments
Closed

Node.js freezes on stdin buffer larger than 163840 bytes #3307

zanona opened this issue Jun 16, 2018 · 3 comments

Comments

@zanona
Copy link

zanona commented Jun 16, 2018

Hey guys, I have been experiencing a very odd issue where node is simply freezing whenever calling cmd.stdin.end() with data larger than 163840 bytes.
Perhaps this can be related to #1774, however I decided it's best to open a new issue, since it may as well be a different thing.

The code below works fine on OSX and Linux, but surprisingly fails on WSL runnnig Ubuntu.

const spawn = require('child_process').spawn;
const cmd = spawn('wc', ['-c']);
const stdin = Buffer.alloc(163841); // works when using 163840
cmd.stdout.pipe(process.stdout);
cmd.stdin.write(stdin);
cmd.stdin.end();

I also noticed that when piping a large stdin directly with process.stdin.pipe(cmd.stdin) the problem didn't occurr at all, however, whenever manipulating stdin like the above, will cause this unexpected behaviour.

specs

  • Windows 10 - 1803 (build 17686.1003)
  • Ubuntu 16.04 LTS (build 20180510.1)
  • Same behaviour on Debian 9
  • Node.js 10.4.1
@therealkenc
Copy link
Collaborator

You deleted the template. strace -f -o yourthing.strace node yourthing.js. Please link a gist.

@therealkenc
Copy link
Collaborator

therealkenc commented Jun 16, 2018

nvm. Spins on epoll_wait(). This is a tight repro of #3191

@zanona
Copy link
Author

zanona commented Jun 28, 2018

Fixed on build 17704 as per #3191 (comment)

Thanks, so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants