Skip to content

os: document the hard limit of concurrent writes to *File changed in Go1.9 #32544

@kokizzu

Description

@kokizzu

What version of Go are you using (go version)?

$ go version
go version go1.12 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/kyz/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/kyz/MEGA/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/lib/go"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build034856733=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Running old code that works on go 1.8 but failed on go 1.12
https://stackoverflow.com/questions/41894046/

What did you expect to see?

no error as previous version of go 1.8

What did you see instead?

$ go build test.go ; for k in 5 50 500 5000 50000 500000; do echo -n $k; time ./test $k > /dev/null; done
5
CPU: 0.00s      Real: 0.00s     RAM: 3972KB
50
CPU: 0.33s      Real: 0.09s     RAM: 49672KB
500
CPU: 4.21s      Real: 0.95s     RAM: 521536KB
5000panic: too many concurrent operations on a single file or socket (max 1048575)

goroutine 3364987 [running]:
internal/poll.(*fdMutex).rwlock(0xc0000680c0, 0x0, 0x0)
        /usr/lib/go/src/internal/poll/fd_mutex.go:147 +0x13f
internal/poll.(*FD).writeLock(...)
        /usr/lib/go/src/internal/poll/fd_mutex.go:239
internal/poll.(*FD).Write(0xc0000680c0, 0xc0b28575d0, 0x8, 0x8, 0x0, 0x0, 0x0)
        /usr/lib/go/src/internal/poll/fd_unix.go:255 +0x4e
os.(*File).write(...)
        /usr/lib/go/src/os/file_unix.go:280
os.(*File).Write(0xc00000e018, 0xc0b28575d0, 0x8, 0x8, 0x0, 0xc0b2b79f60, 0x40890b)
        /usr/lib/go/src/os/file.go:145 +0x76
fmt.Fprintln(0x4d2300, 0xc00000e018, 0xc0b2b79fb0, 0x1, 0x1, 0x0, 0x0, 0x0)
        /usr/lib/go/src/fmt/print.go:266 +0x8b
fmt.Println(...)
        /usr/lib/go/src/fmt/print.go:275
main.main.func1(0xc000014130, 0x33583c)
        /tmp/test.go:24 +0xac
created by main.main
        /tmp/test.go:22 +0xe7
Command exited with non-zero status 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions