-
Notifications
You must be signed in to change notification settings - Fork 570
build: unify setting of ulimit and stack_size #687
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
Conversation
Picking up on @shurcooL's comment in gopherjs#669 (comment). We've started randomly seeing std library tests tip over the V8 stack size limit, causing text/template TestMaxExecDepth to fail randomly locally and on CI. This had previously been addressed by @neelance in 1f89545; the --stack_size flag was passed to NodeJS which in turn passed the value onto V8. But per nodejs/node#14567 (comment) it was pointed out that the value of ulimit -s must be >= the value of --stack_size for the --stack_size to make any sort of sense. Hence this commit also harmonises the setting of ulimit -s during the CI test run with the value of --stack_size that is passed to NodeJS (which in turn passes that value onto V8) when running either gopherjs test or gopherjs run.
7c76983
to
3d4e049
Compare
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.
Thanks for factoring out this PR.
I have a question about ulimit -s
, and a lot of small grammar suggestions for that comment. See inline comments.
tool.go
Outdated
@@ -750,9 +750,31 @@ func runNode(script string, args []string, dir string, quiet bool) error { | |||
} | |||
|
|||
if runtime.GOOS != "windows" { | |||
allArgs = append(allArgs, "--stack_size=10000", script) | |||
// For non-windows OS environments, we've seen issues with stack space | |||
// limits causeing Go std library tests that are recursion-heavy to fail |
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.
s/causeing/causing/
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.
"std library" sounds weird. Why shorten one word, but not the other? Let's not shorten any, it's not helpful here.
s/std/standard/
tool.go
Outdated
@@ -750,9 +750,31 @@ func runNode(script string, args []string, dir string, quiet bool) error { | |||
} | |||
|
|||
if runtime.GOOS != "windows" { | |||
allArgs = append(allArgs, "--stack_size=10000", script) | |||
// For non-windows OS environments, we've seen issues with stack space |
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.
/s/windows/Windows/ since it's a brand name.
Also get rid of "OS", "For non-Windows environments" sounds better I think.
tool.go
Outdated
allArgs = append(allArgs, "--stack_size=10000", script) | ||
// For non-windows OS environments, we've seen issues with stack space | ||
// limits causeing Go std library tests that are recursion-heavy to fail | ||
// (see https://github.com/gopherjs/gopherjs/issues/661 for more detail). |
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.
/s/detail/details/ maybe? "more detail" sounds odd.
tool.go
Outdated
// limits causeing Go std library tests that are recursion-heavy to fail | ||
// (see https://github.com/gopherjs/gopherjs/issues/661 for more detail). | ||
// | ||
// There are two limits that come into play here, listed in order: |
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.
What does "listed in order" signify? If their order is important, how?
If not, just remove the phrase.
tool.go
Outdated
// 2. OS process limit | ||
// | ||
// In order to limit the surface area of the gopherjs command and not | ||
// expose V8 flags/options etc to the caller, we control limit 1 via |
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.
s/etc/, etc.,/
tool.go
Outdated
// | ||
// In order to limit the surface area of the gopherjs command and not | ||
// expose V8 flags/options etc to the caller, we control limit 1 via | ||
// limit 2. That is to say, whatever value is returned by ulimit -s is |
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.
We can probably get rid of "That is to say," it doesn't seem to add value to the sentence.
tool.go
Outdated
// In order to limit the surface area of the gopherjs command and not | ||
// expose V8 flags/options etc to the caller, we control limit 1 via | ||
// limit 2. That is to say, whatever value is returned by ulimit -s is | ||
// essentially the value that we pass on to NodeJS via the appropriate V8 |
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.
Remove "essentially". It's exactly equal to the value, isn't it?
tool.go
Outdated
if err != nil { | ||
return fmt.Errorf("failed to get stack size limit: %v", err) | ||
} | ||
// rlimit value is in bytes, we need rounded kBytes value per node --v8-options. |
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.
/s/kBytes/kilobytes/
Shortening just looks out of place and not saving much here.
circle.yml
Outdated
@@ -20,7 +20,7 @@ test: | |||
- diff -u <(echo -n) <(go list ./compiler/natives/src/...) # All those packages should have // +build js. | |||
- gopherjs install -v net/http # Should build successfully (can't run tests, since only client is supported). | |||
- > | |||
gopherjs test --minify -v --short | |||
ulimit -s 10000 && ulimit -s && gopherjs test --short -v --minify |
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 understand ulimit -s 10000
sets maximum stack size. Wha does ulimit -s
(the second command) do?
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.
Also, please don't change order of flags (unless you have a reason to be doing it). I placed --minify
first on purpose in the previous commits to signify it's the most important flag.
My understanding this flag switch is because you rebased the entire line without changing it, is that right?
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.
ulimit -s
is a means of echo-ing out the value of the OS-level stack size limit; I included it as a means of confirming the previous command was having the intended effect: not strictly necessary so I've removed it.
Also, please don't change order of flags (unless you have a reason to be doing it). I placed --minify first on purpose in the previous commits to signify it's the most important flag.
Ok.
My understanding this flag switch is because you rebased the entire line without changing it, is that right?
Yes.
@shurcooL addressed those points. Let me know if there's anything else. |
Try to improve readability, remove unhelpful and out of place details (they can be found via git blame if needed).
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.
Sorry about the delay, and thanks for working on this again. I've applied some minor wording and style adjustments, but overall I think this looks good and as simple as it can be.
I think we should merge it now and look to see if the same test failures happen again. If anything comes up, we can revisit this.
LGTM.
Thanks @shurcooL |
Waiting for the Go 1.9 branch to land first - DONE in #651Picking up on @shurcooL's comment in #669 (comment).
We've started randomly seeing std library tests tip over the V8 stack size limit, causing text/template TestMaxExecDepth to fail randomly locally and on CI. This had previously been addressed by @neelance in 1f89545; the
--stack_size
flag was passed to NodeJS which in turn passed the value onto V8. But per nodejs/node#14567 (comment) it was pointed out that the value ofulimit -s
must be>=
the value of--stack_size
for the--stack_size
to make any sort of sense. Hence this commit also harmonises the setting ofulimit -s
during the CI test run with the value of--stack_size
that is passed to NodeJS (which in turn passes that value onto V8) when running either gopherjs test or gopherjs run.