Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/internal/fastwalk: sometimes fails with "readdirent: interrupted system call" #44478

Closed
shogo82148 opened this issue Feb 21, 2021 · 2 comments · Fixed by saracen/walker#6
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@shogo82148
Copy link

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

$ go version
go version go1.16 darwin/amd64

Does this issue reproduce with the latest release?

this issue reproduces the current HEAD of master branch: https://github.com/golang/tools/tree/2363391a5b2fe95c264da3c106a6ecca73490587

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/shogoichinose/Library/Caches/go-build"
GOENV="/Users/shogoichinose/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/shogoichinose/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/shogoichinose"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/shogoichinose/src/go.googlesource.com/tools/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/sm/3m28zgs52mbd8tzc8j1jylw00000gn/T/go-build3849489458=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I ran the following commands.

git clone git@github.com:golang/tools.git
cd tools
go test -bench . ./internal/fastwalk

What did you expect to see?

I want to see the result of benchmark.

goos: darwin
goarch: amd64
pkg: golang.org/x/tools/internal/fastwalk
cpu: Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
BenchmarkFastWalk-8   	       9	 116071365 ns/op	  852010 B/op	   25332 allocs/op
PASS
ok  	golang.org/x/tools/internal/fastwalk	1.284s

What did you see instead?

sometimes fails with "readdirent: interrupted system call".

goos: darwin
goarch: amd64
pkg: golang.org/x/tools/internal/fastwalk
cpu: Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
BenchmarkFastWalk-8   	--- FAIL: BenchmarkFastWalk-8
    fastwalk_test.go:249: readdirent: interrupted system call
FAIL
exit status 1
FAIL	golang.org/x/tools/internal/fastwalk	1.497s
FAIL
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Feb 21, 2021
@gopherbot gopherbot added this to the Unreleased milestone Feb 21, 2021
@gopherbot
Copy link

Change https://golang.org/cl/294730 mentions this issue: x/tools/internal/fastwalk: fixes "readdirent: interrupted system call" error

@shogo82148
Copy link
Author

It looks that syscall.Open has same issue.

$ go test -bench . ./internal/fastwalk -benchtime 1m -run none
goos: darwin
goarch: amd64
pkg: golang.org/x/tools/internal/fastwalk
cpu: Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
BenchmarkFastWalk-8     --- FAIL: BenchmarkFastWalk-8
    fastwalk_test.go:249: open /usr/local/go/src/cmd/go/internal/generate: interrupted system call
FAIL
exit status 1
FAIL    golang.org/x/tools/internal/fastwalk    8.683s
FAIL

rinchsan pushed a commit to rinchsan/gosimports that referenced this issue May 30, 2021
According to https://golang.org/doc/go1.14#runtime
A consequence of the implementation of preemption is that on Unix systems, including Linux and macOS
systems, programs built with Go 1.14 will receive more signals than programs built with earlier releases.

This causes syscall.Open and syscall.ReadDirent sometimes fail with EINTR errors.
We need to retry in this case.

Fixes golang/go#44478

Change-Id: I0b0291471e47e8682fac791e1ed024b5a42a56f8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/294730
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Heschi Kreinick <heschi@google.com>
Trust: Peter Weinberger <pjw@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants