Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
merged 3 commits into from
Sep 6, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Adjust documentation and code style.
Try to improve readability, remove unhelpful and out of place details
(they can be found via git blame if needed).
  • Loading branch information
dmitshur authored Sep 6, 2017
commit d7551a07c05c499c06c282dd04bb5b4eb99efe84
26 changes: 13 additions & 13 deletions 26 tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,27 +750,27 @@ func runNode(script string, args []string, dir string, quiet bool) error {
}

if runtime.GOOS != "windows" {
// For non-Windows environments, we've seen issues with stack space
// limits causing Go standard library tests that are recursion-heavy to
// fail (see https://github.com/gopherjs/gopherjs/issues/661 for more details).
// We've seen issues with stack space limits causing
// recursion-heavy standard library tests to fail (e.g., see
// https://github.com/gopherjs/gopherjs/pull/669#issuecomment-319319483).
//
// There are two limits that come into play here:
// There are two separate limits in non-Windows environments:
//
// 1. V8 limit (NodeJS effectively wraps V8)
// 2. OS process limit
// - OS process limit
// - Node.js (V8) limit
//
// GopherJS fetches the current OS process limit, and sets the
// Node.js limit to the same value. So both limits are kept in sync
// and can be controlled by setting OS process limit. E.g.:
//
// ulimit -s 10000 && gopherjs test
//
// 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. Whatever value is returned by ulimit -s is the value that we
// pass on to NodeJS via the appropriate V8 flag.
var r syscall.Rlimit
err := syscall.Getrlimit(syscall.RLIMIT_STACK, &r)
if err != nil {
return fmt.Errorf("failed to get stack size limit: %v", err)
}
// rlimit value is in bytes, we need rounded kilobytes value per node --v8-options.
stackSize := fmt.Sprintf("--stack_size=%v", r.Cur/1000)
allArgs = append(allArgs, stackSize)
allArgs = append(allArgs, fmt.Sprintf("--stack_size=%v", r.Cur/1000)) // Convert from bytes to KB.
}

allArgs = append(allArgs, script)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.