Skip to content

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

@myitcv

Description

@myitcv

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions