-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
doc,test: fix default maxBuffer size #22894
Conversation
760f652
to
d238499
Compare
d238499
to
d49e5aa
Compare
That test only verify if |
Doesn't it throw error if buffer size over default ? |
I thought that it was cause the size allocated, but actually it is accepting really long buffers and if surpass extremely large values, the buffer gets a small size again, it should be fixed instead of documented imo |
Thank you for all review. I created new PR that work default maxBuffer. Please review it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. See #23027 (comment) for discussion.
@koh110 or whoever lands this: please add this information from the PR description to the commit message body before landing:
Correctly document the default maxBuffer size for execSync, execFileSync, and spawnSync. It is 200 * 1024, not Infinity. Add tests to verify behaviour is as documented.
@koh110 Are you sure the documentation changes here are complete? Since execSync and execFileSync call spawnSync, doesn't their documentation need to be changed as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you manually confirm that these tests pass as-is, but fail when the default is changed, as it is in #23027?
d49e5aa
to
8867efd
Compare
@sam-github execSync and execFileSync document need to be changed. Thank for your pointing out. I fixed it. This code is passed Node.js v10.15.0. const args = ['-e', "console.log('a'.repeat(200 * 1024))"];
spawnSync(process.execPath, args); It will fail when the default is changed. This test shows it. |
cc @nodejs/child_process |
@nodejs/documentation Anyone else approve? |
1ba4c1d
to
b297c71
Compare
@nodejs/documentation Anyone else approve? |
/cc @nodejs/documentation |
b297c71
to
37bf7c8
Compare
Anyone else approve? |
@thefourtheye If you don't have other comments, would you approve? |
@thefourtheye ping |
08934cf
to
8ab3cb1
Compare
@sam-github CI failed, but test is not wrong. This reason is timeout on Travis. Would you kick CI?
|
@sam-github ping |
Failed on travis, looked like a timeout, test may have ran too long. I restarted. Is there any chance the tests you added to prove that the maxBuffer is "infinite" are excessively time/cpu/memory consuming? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm building locally, to get a sense for the performance of this. It might use too much data. I might see if the console.logs that write giant strings can be written in a way that runs faster, or uses less memory.
We can't merge tests that make travis ci flaky. There is another set of tests, test/pummel
, that some of these could perhaps go into if its not stable in test/parallel
. They get run less frequently, but would still serve to check if the default behaviour changed.
Please lower-case the filenames, and use consistent suffixes: change the |
There was an issue with Travis builds in general timing out that was fixed a few days ago in #27002. |
Builds tend to take 24-30 minutes, see https://travis-ci.com/nodejs/node/builds https://travis-ci.com/nodejs/node/builds/106252842 for this PR is up to 50 |
Btw, |
The Travis build for this PR was timing out compiling V8/Node.js and didn't even start running the tests. This is unlikely to be caused by this PR, which only touches documentation and tests. I've wiped out the cache in Travis for this PR so that it instead it picks up the cache for the master branch and restarted the build. It's in progress but looks to be much faster (compilation has actually succeeded and it's started running tests now). Update: Travis build passed. |
@richardlau so you think this is stable enough to merge? I think it needs one more approval, @nodejs/child_process , though since its been open for much more than 7 days, maybe my approval alone is sufficient? |
From the point of view of not destabilizing the build, yes. |
Correctly document the default maxBuffer size for execSync, execFileSync, and spawnSync. It is 200 * 1024, not Infinity. Add tests to verify behaviour is as documented.
2cdf3fa
to
f605ba9
Compare
@koh110 I pushed my suggested changes. I'll merge this when CI is green. Thanks for your patience. |
Landed in ceb80f4 |
Correctly document the default maxBuffer size for execSync, execFileSync, and spawnSync. It is 200 * 1024, not Infinity. Add tests to verify behaviour is as documented. PR-URL: #22894 Reviewed-By: Sam Roberts <[email protected]>
Correctly document the default maxBuffer size for execSync, execFileSync, and spawnSync. It is 200 * 1024, not Infinity. Add tests to verify behaviour is as documented. PR-URL: #22894 Reviewed-By: Sam Roberts <[email protected]>
Set the default maxBuffer size to 204,800 bytes for execSync, execFileSync, and spawnSync. APIs that return the child output as a string should have non-infinite defaults for maxBuffer sizes to avoid out-of-memory error conditions. A non-infinite default used to be the documented behaviour for all relevant APIs, but the implemented behaviour for execSync, execFileSync and spawnSync was to have no maxBuffer limits. PR-URL: #23027 Refs: #22894 Reviewed-By: Sam Roberts <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Correctly document the default maxBuffer size for execSync, execFileSync, and spawnSync. It is 200 * 1024, not Infinity. Add tests to verify behaviour is as documented. PR-URL: #22894 Reviewed-By: Sam Roberts <[email protected]> Signed-off-by: Beth Griggs <[email protected]>
Correctly document the default maxBuffer size for execSync, execFileSync, and spawnSync. It is 200 * 1024, not Infinity. Add tests to verify behaviour is as documented. PR-URL: #22894 Reviewed-By: Sam Roberts <[email protected]> Signed-off-by: Beth Griggs <[email protected]>
Fixed document default maxBuffer size at spawnSync. I changed
200 * 1024
toInfinity
.And add test to spawnSync, exec and execFile according to the document.
I think that maxBuffer size should be
200 * 1024
at spawnSync, but comment said that maxBuffer size allowedInfinity
ontest/parallel/test-child-process-spawnsync-maxbuf.js
. And it is working now.Therefore, I just change document and add test.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes