-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
child_process.spawn() has undocumented 200kb buffer limit #4236
Comments
That depends on with what options you spawned the child process. With It's possible the documentation could be clearer (pull requests welcome) but it's working as intended, it implements flow control the same way |
Probably, I've found that option confusing in the past. |
I got this problem in 2015 and write a post on medium, maybe I can help to document this :) |
@bnoordhuis I see the limit buffer for this cases are stored in Lines 766 to 770 in ed3d8b1
Lines 596 to 598 in ed3d8b1
I think for better documentation will be nice, if I can provide a value of the max bytes we can write in the std/out/err by default. |
it's really a problem, it will cause the process hang-up if you do not handle the stdout or stderr. I think the document should be clearer, or it will be really weird for someone who haven't handled the stdout or stderr. |
To fix the docs just need to know whats the real limit as I say in my last comment :( |
I think (but I could be wrong), that @bnoordhuis comment "those have limited (and platform-specific) capacity" means that the limits you're looking for come from the operating system, and not values defined in Node/libuv. |
Yeah, I see this comment @cjihrig, but looking in the code I'm little confused about this. :/ Will try found this information in some place :/ |
@nodejs/documentation |
Add an explanation of the risk of exceeding platform pipe capacity with uncaptured output in child_process.spawn with stdio of pipe Fixes: nodejs#4236
Add an explanation of the risk of exceeding platform pipe capacity with uncaptured output in child_process.spawn with stdio of pipe PR-URL: #19075 Fixes: #4236 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
I am using spawn in CI and for some reason it doesn't redirect to stdout directly while it does on my host. This result to the following message:
is there a way to increase maxBuffer or to force npx to work the stdout ? |
Add an explanation of the risk of exceeding platform pipe capacity with uncaptured output in child_process.spawn with stdio of pipe PR-URL: #19075 Fixes: #4236 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
The child_process.spawn() function will pause a script's execution if it writes more than 200kb of stdout that isn't captured. I discovered this when my spawned process would suspiciously pause after exactly a certain amount of output.
Adding a listener for stdout that does nothing fixed it and allowed the script to run:
This is not documented in the docs. Is this intentional (and hence should be documented) or a bug?
The text was updated successfully, but these errors were encountered: