Commit c7ae41e5 authored by Ian Lance Taylor's avatar Ian Lance Taylor

runtime: better error message for newosproc failure

If creating a new thread fails with EAGAIN, point the user at ulimit.

Fixes #15476.

Change-Id: Ib36519614b5c72776ea7f218a0c62df1dd91a8ea
Reviewed-on: https://go-review.googlesource.com/24570
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 8641e6fe
......@@ -165,6 +165,9 @@ func newosproc(mp *m, _ unsafe.Pointer) {
sigprocmask(_SIG_SETMASK, &oset, nil)
if ret != 0 {
print("runtime: failed to create new OS thread (have ", mcount(), " already; errno=", ret, ")\n")
if ret == -_EAGAIN {
println("runtime: may need to increase max user processes (ulimit -u)")
}
throw("newosproc")
}
}
......
......@@ -134,6 +134,7 @@ func newosproc(mp *m, stk unsafe.Pointer) {
tid2: nil,
}
// TODO: Check for error.
lwp_create(&params)
sigprocmask(_SIG_SETMASK, &oset, nil)
}
......
......@@ -121,6 +121,7 @@ func newosproc(mp *m, stk unsafe.Pointer) {
var oset sigset
sigprocmask(_SIG_SETMASK, &sigset_all, &oset)
// TODO: Check for error.
thr_new(&param, int32(unsafe.Sizeof(param)))
sigprocmask(_SIG_SETMASK, &oset, nil)
}
......
......@@ -154,6 +154,9 @@ func newosproc(mp *m, stk unsafe.Pointer) {
if ret < 0 {
print("runtime: failed to create new OS thread (have ", mcount(), " already; errno=", -ret, ")\n")
if ret == -_EAGAIN {
println("runtime: may need to increase max user processes (ulimit -u)")
}
throw("newosproc")
}
}
......
......@@ -20,6 +20,8 @@ const (
// From NetBSD's <sys/ucontext.h>
_UC_SIGMASK = 0x01
_UC_CPU = 0x04
_EAGAIN = 35
)
type mOS struct {
......@@ -162,6 +164,9 @@ func newosproc(mp *m, stk unsafe.Pointer) {
ret := lwp_create(unsafe.Pointer(&uc), 0, unsafe.Pointer(&mp.procid))
if ret < 0 {
print("runtime: failed to create new OS thread (have ", mcount()-1, " already; errno=", -ret, ")\n")
if ret == -_EAGAIN {
println("runtime: may need to increase max user processes (ulimit -p)")
}
throw("runtime.newosproc")
}
}
......
......@@ -154,6 +154,9 @@ func newosproc(mp *m, stk unsafe.Pointer) {
if ret < 0 {
print("runtime: failed to create new OS thread (have ", mcount()-1, " already; errno=", -ret, ")\n")
if ret == -_EAGAIN {
println("runtime: may need to increase max user processes (ulimit -p)")
}
throw("runtime.newosproc")
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment