runtime: skip /proc reads when containermaxprocs=0#78124
runtime: skip /proc reads when containermaxprocs=0#78124zheliu2 wants to merge 2 commits intogolang:masterfrom
Conversation
When GODEBUG=containermaxprocs=0, skip reading /proc/self/cgroup and /proc/self/mountinfo entirely. Previously these files were read unconditionally at startup, causing permission denied errors in confined environments like Snap packages. Fixes golang#77911
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
This PR (HEAD: 1811862) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/754941. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
|
Message from Jorropo: Patch Set 1: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
|
Message from Go LUCI: Patch Set 1: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2026-03-13T01:05:32Z","revision":"3d57cadbea06e3f47b425573f5f74018f07abebc"} Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
|
Message from Jorropo: Patch Set 1: -Commit-Queue (Performed by <GERRIT_ACCOUNT_60063> on behalf of <GERRIT_ACCOUNT_55763>) Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
|
Message from Go LUCI: Patch Set 1: This CL has failed the run. Reason: Tryjob golang/try/gotip-linux-amd64-sizespecializedmalloc has failed with summary (view all results):
To reproduce, try Additional links for debugging: Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
|
Message from Go LUCI: Patch Set 1: LUCI-TryBot-Result-1 Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
|
Message from Michael Knyszek: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
|
Message from zhe liu: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/754941. |
When
GODEBUG=containermaxprocs=0, skip reading/proc/self/cgroupand/proc/self/mountinfoentirely indefaultGOMAXPROCSInit. Previouslythese files were read unconditionally at startup, then the result was
discarded when the GODEBUG check failed. This caused permission denied
log noise in confined environments like Snap packages.
The fix moves the
debug.containermaxprocscheck before thecgroup.OpenCPUcall so no file I/O occurs when the feature is disabled.Fixes #77911