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: "checkptr: unsafe pointer conversion" during darwin race test #37269

Closed
leitzler opened this issue Feb 17, 2020 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@leitzler
Copy link
Contributor

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

$ go version
go version go1.14rc1 darwin/amd64
$ go list -m golang.org/x/tools golang.org/x/tools/gopls
golang.org/x/tools v0.0.0-20200214225126-5916a50871fb
golang.org/x/tools/gopls v0.1.8-0.20200214225126-5916a50871fb

Does this issue reproduce with the latest release?

It doesn't reproduce on tip (88e564e) oddly enough.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/pontus/Library/Caches/go-build"
GOENV="/Users/pontus/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/pontus/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/pontus/sdk/go1.14rc1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/pontus/sdk/go1.14rc1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/var/folders/xm/ls208xd174v95pgd20rn_qbh0000gn/T/tmp.fpwCXEm4/govim/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 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/xm/ls208xd174v95pgd20rn_qbh0000gn/T/go-build000868657=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I ran the govim test suite using -race under go 1.14rc1. It involves a lot of interaction with gopls. During the tests gopls stack dumps.

Repro (requires vim 8.2 installed):

$ cd $(mktemp -d) && git clone https://github.com/govim/govim
$ cd govim
$ git checkout 83e6313d8a087ff127ba7fae2af815d34e1b7b8a
$ VIM_FLAVOR=vim go1.14rc1 test ./... -race

What did you expect to see?

Test pass

What did you see instead?

2020-02-17T21:54:28.962796_#15: gopls stderr: fatal error: checkptr: unsafe pointer conversion
2020-02-17T21:54:28.966302_#15: gopls stderr:
2020-02-17T21:54:28.966382_#15: gopls stderr: goroutine 1540 [running]:
2020-02-17T21:54:28.966433_#15: gopls stderr: runtime.throw(0x1ccb40c, 0x23)
2020-02-17T21:54:28.966485_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/runtime/panic.go:1112 +0x72 fp=0xc0002bfba8 sp=0xc0002bfb78 pc=0x1073a12
2020-02-17T21:54:28.966528_#15: gopls stderr: runtime.checkptrAlignment(0xc0002c1c08, 0x1c44820, 0x1)
2020-02-17T21:54:28.966559_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/runtime/checkptr.go:18 +0xb7 fp=0xc0002bfbd8 sp=0xc0002bfba8 pc=0x1045ac7
2020-02-17T21:54:28.966589_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.parseDirEnt(0xc0002c1c08, 0x148, 0x170, 0x30, 0xc001137b80, 0x16, 0x0)
2020-02-17T21:54:28.966619_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk_unix.go:80 +0x77 fp=0xc0002bfc80 sp=0xc0002bfbd8 pc=0x1383987
2020-02-17T21:54:28.966662_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.readDir(0xc000cd57d0, 0x27, 0xc0002c1e10, 0x0, 0x0)
2020-02-17T21:54:28.966694_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk_unix.go:46 +0x173 fp=0xc0002c1dc8 sp=0xc0002bfc80 pc=0x1383353
2020-02-17T21:54:28.966734_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).walk(0xc001955500, 0xc000cd57d0, 0x27, 0x1, 0x1, 0x0)
2020-02-17T21:54:28.966775_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:195 +0x7b fp=0xc0002c1e30 sp=0xc0002c1dc8 pc=0x138309b
2020-02-17T21:54:28.966813_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).doWork(0xc001955500, 0xc0015e7610)
2020-02-17T21:54:28.966850_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:134 +0x24b fp=0xc0002c1fd0 sp=0xc0002c1e30 pc=0x1382acb
2020-02-17T21:54:28.966882_#15: gopls stderr: runtime.goexit()
2020-02-17T21:54:28.966908_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/runtime/asm_amd64.s:1375 +0x1 fp=0xc0002c1fd8 sp=0xc0002c1fd0 pc=0x10a7dc1
2020-02-17T21:54:28.966955_#15: gopls stderr: created by golang.org/x/tools/internal/fastwalk.Walk
2020-02-17T21:54:28.966986_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:81 +0x35a
2020-02-17T21:54:28.967011_#15: gopls stderr:
2020-02-17T21:54:28.967048_#15: gopls stderr: goroutine 1 [syscall]:
2020-02-17T21:54:28.967085_#15: gopls stderr: syscall.syscall(0x10d35c0, 0x0, 0xc000380000, 0x1000, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.967111_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/runtime/sys_darwin.go:63 +0x2e
2020-02-17T21:54:28.967142_#15: gopls stderr: syscall.read(0x0, 0xc000380000, 0x1000, 0x1000, 0xc000120018, 0x0, 0x800000)
2020-02-17T21:54:28.967188_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/zsyscall_darwin_amd64.go:1242 +0x8e
2020-02-17T21:54:28.967216_#15: gopls stderr: syscall.Read(0x0, 0xc000380000, 0x1000, 0x1000, 0x0, 0xc000202e10, 0xc0ffffffff)
2020-02-17T21:54:28.967254_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/syscall_unix.go:189 +0x5b
2020-02-17T21:54:28.967286_#15: gopls stderr: internal/poll.(*FD).Read(0xc000120000, 0xc000380000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.967315_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/internal/poll/fd_unix.go:165 +0x1c8
2020-02-17T21:54:28.967353_#15: gopls stderr: os.(*File).read(...)
2020-02-17T21:54:28.967381_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/os/file_unix.go:263
2020-02-17T21:54:28.967419_#15: gopls stderr: os.(*File).Read(0xc00011e000, 0xc000380000, 0x1000, 0x1000, 0x0, 0xeaf, 0x1)
2020-02-17T21:54:28.967478_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/os/file.go:116 +0xa7
2020-02-17T21:54:28.967520_#15: gopls stderr: bufio.(*Reader).fill(0xc0001f2de0)
2020-02-17T21:54:28.967558_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/bufio/bufio.go:100 +0x19a
2020-02-17T21:54:28.967591_#15: gopls stderr: bufio.(*Reader).ReadSlice(0xc0001f2de0, 0xa, 0xc000214c00, 0x104c458, 0x20, 0xc00012b120, 0xc000202f10)
2020-02-17T21:54:28.968300_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/bufio/bufio.go:359 +0x96
2020-02-17T21:54:28.968346_#15: gopls stderr: bufio.(*Reader).ReadBytes(0xc0001f2de0, 0xa, 0x0, 0x8, 0x34ac190f4c216ddf, 0xc0001cb320, 0x1084d77)
2020-02-17T21:54:28.968383_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/bufio/bufio.go:438 +0x9b
2020-02-17T21:54:28.968414_#15: gopls stderr: bufio.(*Reader).ReadString(...)
2020-02-17T21:54:28.968452_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/bufio/bufio.go:475
2020-02-17T21:54:28.968499_#15: gopls stderr: golang.org/x/tools/internal/jsonrpc2.(*headerStream).Read(0xc000129b00, 0x1e57ae0, 0xc0001fae40, 0x14bbb5e, 0x0, 0x0, 0xc0001cb708, 0x107e08e, 0xc0001cb390)
2020-02-17T21:54:28.968555_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/jsonrpc2/stream.go:97 +0xb9
2020-02-17T21:54:28.968592_#15: gopls stderr: golang.org/x/tools/internal/lsp/protocol.(*loggingStream).Read(0xc000129b20, 0x1e57ae0, 0xc0001fae40, 0xc00029e180, 0xc0001f2e40, 0x1e57ae0, 0xc000202d80, 0x0, 0x0)
2020-02-17T21:54:28.968624_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/protocol/log.go:26 +0x78
2020-02-17T21:54:28.968651_#15: gopls stderr: golang.org/x/tools/internal/jsonrpc2.(*Conn).Run(0xc0001f2e40, 0x1e57ae0, 0xc0001fae40, 0x1e34550, 0x1c5a800)
2020-02-17T21:54:28.968687_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/jsonrpc2/jsonrpc2.go:317 +0xd2
2020-02-17T21:54:28.968731_#15: gopls stderr: golang.org/x/tools/internal/lsp/lsprpc.(*StreamServer).ServeStream(0xc0001138e0, 0x1e57a60, 0xc00011c000, 0x1e4c0a0, 0xc000129b20, 0xc0001138c0, 0x0)
2020-02-17T21:54:28.968774_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/lsprpc/lsprpc.go:55 +0x607
2020-02-17T21:54:28.968818_#15: gopls stderr: golang.org/x/tools/internal/lsp/cmd.(*Serve).Run(0xc0001fc370, 0x1e57a60, 0xc00011c000, 0xc00012a030, 0x0, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.968858_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/cmd/serve.go:83 +0x5db
2020-02-17T21:54:28.968901_#15: gopls stderr: golang.org/x/tools/internal/tool.Run(0x1e57a60, 0xc00011c000, 0x1e5b260, 0xc0001fc370, 0xc00012a030, 0x0, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.968931_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/tool/tool.go:152 +0x305
2020-02-17T21:54:28.968967_#15: gopls stderr: golang.org/x/tools/internal/lsp/cmd.(*Application).Run(0xc0001fc340, 0x1e57a60, 0xc00011c000, 0xc00012a030, 0x0, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.969002_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/cmd/cmd.go:143 +0x4b9
2020-02-17T21:54:28.969042_#15: gopls stderr: golang.org/x/tools/internal/tool.Run(0x1e57a60, 0xc00011c000, 0x1e5b220, 0xc0001fc340, 0xc00012a010, 0x3, 0x3, 0x0, 0x0)
2020-02-17T21:54:28.969071_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/tool/tool.go:152 +0x305
2020-02-17T21:54:28.969097_#15: gopls stderr: golang.org/x/tools/internal/tool.Main(0x1e57a60, 0xc00011c000, 0x1e5b220, 0xc0001fc340, 0xc00012a010, 0x3, 0x3)
2020-02-17T21:54:28.969133_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/tool/tool.go:91 +0x1b6
2020-02-17T21:54:28.969171_#15: gopls stderr: main.main()
2020-02-17T21:54:28.969197_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools/gopls@v0.1.8-0.20200214225126-5916a50871fb/main.go:25 +0x113
2020-02-17T21:54:28.969232_#15: gopls stderr:
2020-02-17T21:54:28.969258_#15: gopls stderr: goroutine 1538 [runnable]:
2020-02-17T21:54:28.969286_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).walk(0xc001955500, 0xc000cd5530, 0x22, 0x1, 0x1, 0x0)
2020-02-17T21:54:28.969316_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:184 +0x1b5
2020-02-17T21:54:28.969367_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).doWork(0xc001955500, 0xc0015e7610)
2020-02-17T21:54:28.969405_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:134 +0x24b
2020-02-17T21:54:28.969442_#15: gopls stderr: created by golang.org/x/tools/internal/fastwalk.Walk
2020-02-17T21:54:28.969472_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:81 +0x35a
2020-02-17T21:54:28.969507_#15: gopls stderr:
2020-02-17T21:54:28.969543_#15: gopls stderr: goroutine 1539 [runnable]:
2020-02-17T21:54:28.969568_#15: gopls stderr: syscall.syscallX(0x10d3610, 0xd, 0x0, 0x1, 0xa, 0x0, 0x0)
2020-02-17T21:54:28.969595_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/runtime/sys_darwin_64.go:16 +0x2e
2020-02-17T21:54:28.969640_#15: gopls stderr: syscall.Seek(0xd, 0x0, 0x1, 0xffffffffffffffff, 0x1, 0x0)
2020-02-17T21:54:28.969674_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/zsyscall_darwin_amd64.go:1363 +0x6b
2020-02-17T21:54:28.969707_#15: gopls stderr: syscall.Getdirentries(0xd, 0xc0001c5d78, 0x2000, 0x2000, 0xc0001c5c60, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.969736_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/syscall_darwin.go:389 +0x7d
2020-02-17T21:54:28.969761_#15: gopls stderr: syscall.ReadDirent(0xd, 0xc0001c5d78, 0x2000, 0x2000, 0xc0021502a0, 0x7, 0xc000000000)
2020-02-17T21:54:28.969787_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/syscall_bsd.go:71 +0x97
2020-02-17T21:54:28.969820_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.readDir(0xc000acaba0, 0x27, 0xc0001c7e10, 0x0, 0x0)
2020-02-17T21:54:28.969856_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk_unix.go:38 +0x47d
2020-02-17T21:54:28.969886_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).walk(0xc001955500, 0xc000acaba0, 0x27, 0x1, 0x1, 0x0)
2020-02-17T21:54:28.969916_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:195 +0x7b
2020-02-17T21:54:28.969946_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).doWork(0xc001955500, 0xc0015e7610)
2020-02-17T21:54:28.969992_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:134 +0x24b
2020-02-17T21:54:28.970031_#15: gopls stderr: created by golang.org/x/tools/internal/fastwalk.Walk
2020-02-17T21:54:28.970078_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:81 +0x35a
2020-02-17T21:54:28.970111_#15: gopls stderr:
2020-02-17T21:54:28.970145_#15: gopls stderr: goroutine 40 [chan receive]:
2020-02-17T21:54:28.970178_#15: gopls stderr: golang.org/x/tools/internal/lsp/debug.(*Instance).MonitorMemory.func1(0xc0001f4190, 0xc00011ced0, 0xc0001fc438, 0x1e57a60, 0xc00011c000)
2020-02-17T21:54:28.970217_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/debug/serve.go:341 +0x89
2020-02-17T21:54:28.970243_#15: gopls stderr: created by golang.org/x/tools/internal/lsp/debug.(*Instance).MonitorMemory
2020-02-17T21:54:28.970268_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/debug/serve.go:339 +0xba
2020-02-17T21:54:28.970294_#15: gopls stderr:
2020-02-17T21:54:28.970331_#15: gopls stderr: goroutine 13 [select]:
2020-02-17T21:54:28.970363_#15: gopls stderr: golang.org/x/tools/internal/imports.(*ModuleResolver).scan(0xc000979d60, 0x1e57a60, 0xc00011c000, 0xc001b3f880, 0x0, 0x0)
2020-02-17T21:54:28.970392_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/imports/mod.go:476 +0x53b
2020-02-17T21:54:28.970418_#15: gopls stderr: golang.org/x/tools/internal/imports.addExternalCandidates(0xc000936120, 0xc0019550e0, 0xc0001ce587, 0x6a, 0x0, 0x0)
2020-02-17T21:54:28.970450_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/imports/fix.go:948 +0x426
2020-02-17T21:54:28.970486_#15: gopls stderr: golang.org/x/tools/internal/imports.getFixes(0xc0019b4140, 0xc000ee2080, 0xc0001ce587, 0x6a, 0xc000446000, 0xae, 0xc001b3e5a0, 0xc000ee2080, 0x0, 0x0)
2020-02-17T21:54:28.970514_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/imports/fix.go:578 +0x5ee
2020-02-17T21:54:28.970579_#15: gopls stderr: golang.org/x/tools/internal/imports.FixImports(0xc0001ce587, 0x6a, 0xc0005c28f0, 0x6c, 0xae, 0xc001b3e5a0, 0xae, 0xc001a5e750, 0x0, 0x0, ...)
2020-02-17T21:54:28.970611_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/imports/imports.go:85 +0x265
2020-02-17T21:54:28.970644_#15: gopls stderr: golang.org/x/tools/internal/lsp/source.computeImportEdits(0x1e57ae0, 0xc000607e30, 0x1e66e80, 0xc0002b8000, 0x1e57ca0, 0xc000b07580, 0xc001b3e5a0, 0xc001b3e5a0, 0x20, 0x0, ...)
2020-02-17T21:54:28.970683_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/source/format.go:113 +0x218
2020-02-17T21:54:28.970712_#15: gopls stderr: golang.org/x/tools/internal/lsp/source.AllImportsFixes.func1(0xc001b3e5a0, 0xc001b3e5a0, 0x70)
2020-02-17T21:54:28.970738_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/source/format.go:88 +0x10c
2020-02-17T21:54:28.970772_#15: gopls stderr: golang.org/x/tools/internal/lsp/cache.(*view).RunProcessEnvFunc(0xc0002b8000, 0x1e57ae0, 0xc000607e30, 0xc0021afd10, 0x0, 0x0)
2020-02-17T21:54:28.970803_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/cache/view.go:296 +0x232
2020-02-17T21:54:28.970840_#15: gopls stderr: golang.org/x/tools/internal/lsp/source.AllImportsFixes(0x1e57ae0, 0xc000607e30, 0x1e68780, 0xc0005947e0, 0x1e561a0, 0xc000594780, 0x0, 0xc000129ba0, 0x2, 0x2, ...)
2020-02-17T21:54:28.970869_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/source/format.go:87 +0x66a
2020-02-17T21:54:28.970894_#15: gopls stderr: golang.org/x/tools/internal/lsp.(*Server).codeAction(0xc0001f2f00, 0x1e57ae0, 0xc000202d80, 0xc00039bd80, 0xc00039bd80, 0x0, 0x0, 0x0, 0xc00085eaa8)
2020-02-17T21:54:28.970929_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/code_action.go:68 +0xb68
2020-02-17T21:54:28.970960_#15: gopls stderr: golang.org/x/tools/internal/lsp.(*Server).CodeAction(0xc0001f2f00, 0x1e57ae0, 0xc000202d80, 0xc00039bd80, 0xc00039bd80, 0x0, 0x0, 0x1c969c1, 0x6)
2020-02-17T21:54:28.970995_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/server_gen.go:12 +0x67
2020-02-17T21:54:28.971031_#15: gopls stderr: golang.org/x/tools/internal/lsp/protocol.serverHandler.Deliver(0x1e71340, 0xc0001f2f00, 0x1e57ae0, 0xc000202d80, 0xc00029e180, 0xc00029e100, 0x1071f00)
2020-02-17T21:54:28.971064_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/lsp/protocol/tsserver.go:433 +0x2aa5
2020-02-17T21:54:28.971091_#15: gopls stderr: golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc0002660c0, 0xc00029e180, 0xc0001f2e40, 0x1e57ae0, 0xc000202d80, 0x0, 0x0, 0xc00031a510)
2020-02-17T21:54:28.971119_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/jsonrpc2/jsonrpc2.go:371 +0x1c6
2020-02-17T21:54:28.971149_#15: gopls stderr: created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
2020-02-17T21:54:28.971175_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/jsonrpc2/jsonrpc2.go:355 +0x80d
2020-02-17T21:54:28.971202_#15: gopls stderr:
2020-02-17T21:54:28.971248_#15: gopls stderr: goroutine 1541 [runnable]:
2020-02-17T21:54:28.971277_#15: gopls stderr: syscall.syscall(0x10d34f0, 0x3103270, 0x0, 0x0, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.971306_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/runtime/sys_darwin.go:63 +0x2e
2020-02-17T21:54:28.971348_#15: gopls stderr: syscall.closedir(0x3103270, 0xc001b3e560, 0xc0021a0a40)
2020-02-17T21:54:28.971378_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/zsyscall_darwin_amd64.go:534 +0x5f
2020-02-17T21:54:28.971422_#15: gopls stderr: syscall.Getdirentries(0xf, 0xc0002bbd78, 0x2000, 0x2000, 0xc0002bbc60, 0x0, 0x0, 0x0)
2020-02-17T21:54:28.971460_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/syscall_darwin.go:453 +0x40b
2020-02-17T21:54:28.971494_#15: gopls stderr: syscall.ReadDirent(0xf, 0xc0002bbd78, 0x2000, 0x2000, 0xc080000000, 0x0, 0x0)
2020-02-17T21:54:28.971519_#15: gopls stderr: 	/Users/pontus/sdk/go1.14rc1/src/syscall/syscall_bsd.go:71 +0x97
2020-02-17T21:54:28.971547_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.readDir(0xc000cd55f0, 0x24, 0xc0002bde10, 0x0, 0x0)
2020-02-17T21:54:28.971572_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk_unix.go:38 +0x47d
2020-02-17T21:54:28.971598_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).walk(0xc001955500, 0xc000cd55f0, 0x24, 0x1, 0x1, 0x0)
2020-02-17T21:54:28.971622_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:195 +0x7b
2020-02-17T21:54:28.971654_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.(*walker).doWork(0xc001955500, 0xc0015e7610)
2020-02-17T21:54:28.971680_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:134 +0x24b
2020-02-17T21:54:28.971709_#15: gopls stderr: created by golang.org/x/tools/internal/fastwalk.Walk
2020-02-17T21:54:28.971742_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:81 +0x35a
2020-02-17T21:54:28.971773_#15: gopls stderr:
2020-02-17T21:54:28.971799_#15: gopls stderr: goroutine 1377 [runnable]:
2020-02-17T21:54:28.971828_#15: gopls stderr: golang.org/x/tools/internal/fastwalk.Walk(0xc001baa780, 0x1f, 0xc001e923a0, 0x0, 0x0)
2020-02-17T21:54:28.971861_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/fastwalk/fastwalk.go:93 +0x5ae
2020-02-17T21:54:28.971916_#15: gopls stderr: golang.org/x/tools/internal/gopathwalk.walkDir(0xc001baa780, 0x1f, 0x1, 0xc001e92340, 0xc001e92330, 0x1040100)
2020-02-17T21:54:28.971955_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/gopathwalk/walk.go:99 +0x35f
2020-02-17T21:54:28.971983_#15: gopls stderr: golang.org/x/tools/internal/gopathwalk.WalkSkip(0xc0005b1f08, 0x1, 0x1, 0xc001e92340, 0xc001e92330, 0x1bb0100)
2020-02-17T21:54:28.972017_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/gopathwalk/walk.go:76 +0xbb
2020-02-17T21:54:28.972055_#15: gopls stderr: golang.org/x/tools/internal/imports.(*ModuleResolver).scan.func4(0x1e57a60, 0xc00011c000, 0xc000979d60, 0xc0001906c0, 0x5, 0x8, 0xc001e92340, 0xc001e92330, 0xc001f57d40)
2020-02-17T21:54:28.972080_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/imports/mod.go:471 +0x3c8
2020-02-17T21:54:28.972110_#15: gopls stderr: created by golang.org/x/tools/internal/imports.(*ModuleResolver).scan
2020-02-17T21:54:28.972134_#15: gopls stderr: 	/Users/pontus/go/pkg/mod/golang.org/x/tools@v0.0.0-20200214225126-5916a50871fb/internal/imports/mod.go:455 +0x47f
@gopherbot gopherbot added this to the Unreleased milestone Feb 17, 2020
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Feb 17, 2020
@leitzler
Copy link
Contributor Author

FYI @heschik

@heschi
Copy link
Contributor

heschi commented Feb 17, 2020

@mdempsky @randall77 I could use some help with this one.

There are two possible cases here:

func checkptrAlignment(p unsafe.Pointer, elem *_type, n uintptr) {
// Check that (*[n]elem)(p) is appropriately aligned.
// TODO(mdempsky): What about fieldAlign?
if uintptr(p)&(uintptr(elem.align)-1) != 0 {
throw("checkptr: unsafe pointer conversion")
}
// Check that (*[n]elem)(p) doesn't straddle multiple heap objects.
if size := n * elem.size; size > 1 && checkptrBase(p) != checkptrBase(add(p, size-1)) {
throw("checkptr: unsafe pointer conversion")
}
}

(It would be lovely if they had different error messages. Should I send a CL?)

I think the first case is trivially ruled out by the stack trace -- 0xc0002c1c08 is maximally aligned, right? So my best guess is that the Darwin Getdirentries implementation has returned a bad slice. Am I missing something?

@heschi heschi added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin labels Feb 17, 2020
@leitzler
Copy link
Contributor Author

Ran a quick test with the error messages renamed and it is indeed the second case fwiw.

@mdempsky
Copy link
Member

mdempsky commented Feb 18, 2020

From the stack trace, it looks like the problem is this conversion at https://github.com/golang/tools/blob/b320d3a0f5a29dea7f95f1ca5c4cbef0ac24a304/internal/fastwalk/fastwalk_unix.go#L80:

	dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[0]))

On Darwin, syscall.Dirent's size is >1000 bytes (https://golang.org/pkg/syscall/?GOOS=darwin#Dirent), but I'm guessing buf here is smaller than that.

Easiest fix would be to change it to:

        var dirent syscall.Dirent
        copy((*[unsafe.Sizeof(dirent)]byte)(unsafe.Pointer(&dirent))[:], buf)

@dtbartle
Copy link

I'm seeing the same issue on the just-released go 1.14.

@gopherbot
Copy link

Change https://golang.org/cl/221381 mentions this issue: internal/fastwalk: fix checkptr failure on Darwin

@golang golang locked and limited conversation to collaborators Feb 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants