Skip to content

1.6.2: backport runtime GOMAXPROCS crash fix #15160

@bradfitz

Description

@bradfitz

Tracking bug to decide whether to backport the fix to #15131 (Go binaries failing at start with procresize: invalid arg if there are more than 256 CPUs)

Request to do so from @mwhudson: #15131 (comment)

The fix (31cf1c1) is small and just caps the CPUs to 256:

diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 5145c84..1f55b0f 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -449,6 +449,9 @@ func schedinit() {

        sched.lastpoll = uint64(nanotime())
        procs := int(ncpu)
+       if procs > _MaxGomaxprocs {
+               procs = _MaxGomaxprocs
+       }
        if n := atoi(gogetenv("GOMAXPROCS")); n > 0 {
                if n > _MaxGomaxprocs {
                        n = _MaxGomaxprocs

/cc @rsc @ianlancetaylor

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions