Skip to content

net: maxListenerBacklog panics on empty somaxconn input #82032

Open

Description

@cuishuang

Go version

go version go1.28-devel

Output of go env in your module/workspace:

AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN='/Users/mac/go/bin'
GOCACHE='/Users/mac/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/mac/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/tq/m955dwkd1519phkp2hwpv9_80000gn/T/go-build1415656419=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/Users/mac/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPACKAGESDRIVER=''
GOPATH='/Users/mac/go'
GOPRIVATE=''
GOPROXY=''
GOROOT='/Users/mac/202609/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/mac/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/mac/202609/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.28-devel_d758038bdf Tue Aug 11 10:10:28 2026 -0700'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

On Linux, make /proc/sys/net/core/somaxconn return an empty line or a line containing only whitespace, then trigger net.maxListenerBacklog (for example, by creating a TCP listener).

The file reader can return an empty line with ok == true. getFields then returns an empty slice, and maxListenerBacklog panics when it indexes f[0].

What did you see happen?

A runtime panic due to an index out of range when maxListenerBacklog evaluates f[0].

What did you expect to see?

maxListenerBacklog should handle empty or whitespace-only input gracefully and return syscall.SOMAXCONN, consistent with its fallback behavior for unreadable or invalid values.

Activity

  1. cuishuang commented on Oct 6, 2026

    @cuishuang
    ContributorAuthor
  2. gopherbot commented on Oct 6, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/845685 mentions this issue: net: handle empty somaxconn input

  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    FixPendingIssues that have a fix which has not yet been reviewed or submitted.
    on Oct 6, 2026
  4. added this to the Go1.28 milestone on Oct 6, 2026
  5. dmitshur commented on Oct 6, 2026

    @dmitshur
    Member
  6. ianlancetaylor commented on Oct 6, 2026

    @ianlancetaylor
    Contributor

    On Linux, make /proc/sys/net/core/somaxconn return an empty line or a line containing only whitespace

    How is that possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixPendingIssues that have a fix which has not yet been reviewed or submitted.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions