commit c02de8ea005fb858bdbaf79dd36ea93b1014521b Author: Yawning Angel yawning@schwanenlied.me Date: Fri Dec 16 07:09:42 2016 +0000
Bug #20979: runtime/cgo: pthread_create failed: Resource temporarily unavailable
Since we set the rlimit in the uncontainered sandboxed-tor-browser process, `RLIMIT_NPROC` is applied against every single other process/thread running as the user's real UID. --- ChangeLog | 2 ++ src/cmd/sandboxed-tor-browser/internal/sandbox/rlimit.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 01e28d9..88d2e2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ Changes in version 0.0.3 - UNRELEASED: + * Bug 20979: runtime/cgo: pthread_create failed: Resource temporarily + unavailable. * Bug 20993: Handle the lock file better. * Bug 20970: Firefox crashes if the security slider is left at the default on certain pages. diff --git a/src/cmd/sandboxed-tor-browser/internal/sandbox/rlimit.go b/src/cmd/sandboxed-tor-browser/internal/sandbox/rlimit.go index 46cb2c2..5c4851b 100644 --- a/src/cmd/sandboxed-tor-browser/internal/sandbox/rlimit.go +++ b/src/cmd/sandboxed-tor-browser/internal/sandbox/rlimit.go @@ -48,9 +48,9 @@ func lowerRlimit(resource int, newHard uint64) error { // because it should be tied into the UI. func SetSensibleRlimits() error { const ( - limStack = 8 * 1024 * 1024 // 8 MiB Firefox uses a lot with js... - limRSS = 0 // No effect as of 2.6.x... - limNproc = 512 + limStack = 8 * 1024 * 1024 // 8 MiB Firefox uses a lot with js... + limRSS = 0 // No effect as of 2.6.x... + // limNproc = 512 limNofile = 1024 // Could maybe go as low as 512... limMlock = 0 // This might need to be increased later. limLocks = 32 @@ -61,8 +61,8 @@ func SetSensibleRlimits() error { limRttime = 0
// The syscall package doesn't expose these. - RLIMIT_RSS = 5 - RLIMIT_NPROC = 6 + RLIMIT_RSS = 5 + // RLIMIT_NPROC = 6 RLIMIT_MLOCK = 8 RLIMIT_LOCKS = 10 RLIMIT_SIGPENDING = 11 @@ -78,9 +78,9 @@ func SetSensibleRlimits() error { if err := lowerRlimit(RLIMIT_RSS, limRSS); err != nil { return err } - if err := lowerRlimit(RLIMIT_NPROC, limNproc); err != nil { - return err - } + // if err := lowerRlimit(RLIMIT_NPROC, limNproc); err != nil { + // return err + // } if err := lowerRlimit(syscall.RLIMIT_NOFILE, limNofile); err != nil { return err }