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/gopls: panic in internal/lsp/cache.(*View).RunProcessEnvFunc #40121

Closed
myitcv opened this issue Jul 8, 2020 · 2 comments
Closed

x/tools/gopls: panic in internal/lsp/cache.(*View).RunProcessEnvFunc #40121

myitcv opened this issue Jul 8, 2020 · 2 comments

Comments

@myitcv
Copy link
Member

@myitcv myitcv commented Jul 8, 2020

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

$ go version
go version devel +6b344170db Tue Jul 7 03:43:31 2020 +0000 linux/amd64
$ go list -m golang.org/x/tools
golang.org/x/tools v0.0.0-20200708003708-134513de8882
$ go list -m golang.org/x/tools/gopls
golang.org/x/tools/gopls v0.0.0-20200708003708-134513de8882

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
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOENV="/home/myitcv/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/myitcv/gostuff/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/myitcv/gostuff"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/myitcv/gos"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/myitcv/gostuff/src/github.com/myitcv/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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build533055580=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Running the govim tests within a Docker environment produces the following panic:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb15c6c]

goroutine 101 [running]:
golang.org/x/tools/internal/lsp/cache.(*View).RunProcessEnvFunc(0xc00032c000, 0xeb16a0, 0xc000881470, 0xc0008822d0, 0x0, 0x0)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/lsp/cache/view.go:410 +0x24c
golang.org/x/tools/internal/lsp/source.AllImportsFixes(0xeb16a0, 0xc000881470, 0xec7180, 0xc000890080, 0xeb5420, 0xc0000aab40, 0xc000290300, 0xc0001f5630, 0x5, 0x5, ...)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/lsp/source/format.go:83 +0x2d5
golang.org/x/tools/internal/lsp.(*Server).codeAction(0xc000273080, 0xeb15e0, 0xc000032180, 0xc000890180, 0xc000890180, 0x0, 0x0, 0x0, 0xc0007233f0)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/lsp/code_action.go:82 +0x1876
golang.org/x/tools/internal/lsp.(*Server).CodeAction(0xc000273080, 0xeb15e0, 0xc000032180, 0xc000890180, 0xc000890180, 0x0, 0x0, 0xeaf560, 0xc0000b6100)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/lsp/server_gen.go:12 +0x4d
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0xeb15e0, 0xc000032180, 0xecfbe0, 0xc000273080, 0xc000880bd0, 0xeb1820, 0xc000032100, 0x0, 0x0, 0xbfb9818027d23e7e)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/lsp/protocol/tsserver.go:311 +0x27eb
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0xeb15e0, 0xc000032180, 0xc000880bd0, 0xeb1820, 0xc000032100, 0x0, 0x0)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/lsp/protocol/protocol.go:62 +0xc0
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0xeb15e0, 0xc000032180, 0xc000880bd0, 0xeb1820, 0xc000032100, 0x0, 0x0)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/lsp/lsprpc/lsprpc.go:509 +0x43a
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0xeb15e0, 0xc000032180, 0xc000286d00, 0xeb1820, 0xc000032100, 0x0, 0x0)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/jsonrpc2/handler.go:35 +0xd3
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc00003e060, 0xc00009db00, 0xc000233e20, 0xeb15e0, 0xc000032180, 0xc000286d00, 0xeb1820, 0xc000032100)
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/jsonrpc2/handler.go:103 +0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1
 /home/runner/gopath/pkg/mod/golang.org/x/tools@v0.0.0-20200708003708-134513de8882/internal/jsonrpc2/handler.go:100 +0x171

What did you expect to see?

No panic.

What did you see instead?

The above panic. No tests run


cc @stamblerre

FYI @leitzler

@gopherbot gopherbot added the Tools label Jul 8, 2020
@gopherbot gopherbot added this to the Unreleased milestone Jul 8, 2020
@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Jul 8, 2020

Thanks for reporting.

/cc @heschik - looks like the cached mod file identifier logic needs to handle the case of no mod file

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 8, 2020

Change https://golang.org/cl/241520 mentions this issue: internal/lsp/cache: handle missing mod file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.