go: x/sys/unix: panic when using solaris Event Ports

Summary

If you are running on illumos, you are likely suffering from https://www.illumos.org/issues/14898 and you should look into applying updates. If you are on an LTS release of some sort, you can ask your distro provider if that fix can be backported for you.

If you are running on Solaris, you should probably contact support and send them a link to the illumos issue to see if there’s a corresponding fix available for Solaris.

There’s a small chance that you’re running into golang/go#54363 if the version of x/sys/unix in use doesn’t contain the fix from https://go.dev/cl/422338.

Original Report (for posterity)

CAVEAT

This is clearly my own fault, but I am not smart enough (yet?) to figure out where my bug is. It was introduced while attempting to fix a different problem in https://github.com/golang/sys/commit/594fa53f0001ef3fa9e016f148230ddd59727649 as worked on in https://go-review.googlesource.com/c/sys/+/380034

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

$ go version
go version go1.19 solaris/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
warning: GOPATH set to GOROOT (/home/nshalman/go/) has no effect
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/nshalman/.cache/go-build"
GOENV="/home/nshalman/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="solaris"
GOINSECURE=""
GOMODCACHE="/home/nshalman/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="solaris"
GOPATH="/home/nshalman/go/"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/nshalman/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/nshalman/go/pkg/tool/solaris_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/nshalman/sys/go.mod"
GOWORK=""
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-build3559396907=/tmp/go-build -gno-record-gcc-switches"

What did you do?

See https://github.com/fsnotify/fsnotify/pull/371#issuecomment-1204736359

git clone https://github.com/nshalman/fsnotify -b fen-v2
cd fsnotify
mkdir deleteme
go run ./cmd/fsnotify deleteme/ &
for i in {1..500}; do touch deleteme/$i; done;

What did you expect to see?

No panics

What did you see instead?

panic: mismanaged memory

goroutine 33 [running]:
golang.org/x/sys/unix.(*EventPort).peIntToExt(0xc000200150, 0xc0004f52c0, 0xc000105da8)
        /home/nshalman/go/pkg/mod/golang.org/x/sys@v0.0.0-20220731174439-a90be440212d/unix/syscall_solaris.go:959 +0x265
golang.org/x/sys/unix.(*EventPort).Get(0xc000200150, {0xc000105da8, 0x8, 0x0?}, 0x0?, 0x0?)
        /home/nshalman/go/pkg/mod/golang.org/x/sys@v0.0.0-20220731174439-a90be440212d/unix/syscall_solaris.go:1002 +0x2e9
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc000200060)
        /home/nshalman/deleteme/fsnotify/fen.go:148 +0x10a
created by github.com/fsnotify/fsnotify.NewWatcher
        /home/nshalman/deleteme/fsnotify/fen.go:47 +0x165
exit status 2

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@davepacheco No worries. (For future notice, see https://go.dev/wiki/Questions for good places to ask questions about Go.)