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: cannot resolve import block when a change adds one package but removes the other #34052

Closed
ucirello opened this issue Sep 3, 2019 · 14 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@ucirello
Copy link
Contributor

ucirello commented Sep 3, 2019

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

$ go version
go version go1.13 darwin/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
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/user/src/project"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/user/src/project/src/github.com/project/web/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/_l/9yb78fmx0jzb8khycvrzw3qw0000gn/T/go-build144940187=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Step 1: create a file like this:

package main

import "fmt"

func main() {
	fmt.Println(42)
}

Make sure it is saved.

Using vscode or some editor, invoke gopls and make sure it has seen the file at least once.

Open the file and replace:

fmt.Println(42)

with

log.Println(42)

What did you expect to see?

I would expect to see the import block resolved with log replacing fmt. That was the behavior with goimports.

What did you see instead?

gopls fails - no other operation works.

@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting section of the gopls Wiki page, and make sure that you have provided all of the relevant information here.

@gopherbot gopherbot added this to the Unreleased milestone Sep 3, 2019
@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Sep 3, 2019
@ucirello
Copy link
Contributor Author

ucirello commented Sep 3, 2019

  • Your editor and any settings you have configured (for example, your VSCode settings.json file).
    VSCode
Version: 1.37.1
Commit: f06011ac164ae4dc8e753a3fe7f9549844d15e35
Date: 2019-08-15T16:16:34.800Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Darwin x64 18.7.0
{
	"go.useLanguageServer": true,
	"[go]": {
		"editor.snippetSuggestions": "none",
		"editor.formatOnSave": true,
		"editor.codeActionsOnSave": {
			"source.organizeImports": true
		},
		"editor.codeActionsOnSaveTimeout": 15000
	},
	"gopls": {
		"usePlaceholders": false,
		"wantCompletionDocumentation": false
	},
	"files.eol": "\n",
	"go.languageServerFlags": [
		"-rpc.trace", // for more detailed debug logging
		"serve",
		"--debug=localhost:6060", // to investigate memory usage, see profiles
	],
}
  • The output of gopls version on the command line.
$ gopls version
golang.org/x/tools/cmd/gopls v0.1.3-cmd.gopls
    golang.org/x/tools@v0.0.0-20190903163617-be0da057c5e3 h1:1cLrGl9PL64Mzl9NATDCqFE57dVYwWOkoPXvppEnjO4=
  • The output of gopls -rpc.trace -v check /path/to/file.
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 22.159623ms for GOROOT= GOPATH=/Users/user/src/project GO111MODULE=on PWD=/Users/user/src/project/src/github.com/project/web go "env" "GOMOD", stderr: <<>>
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 111.901037ms for GOROOT= GOPATH=/Users/user/src/project GO111MODULE=on PWD=/Users/user/src/project/src/github.com/project/web go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "builtin", stderr: <<>>
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 189.261791ms for GOROOT= GOPATH=/Users/user/src/project GO111MODULE=on PWD=/Users/user/src/project/src/github.com/project/web go "list" "-m" "-json" "all", stderr: <<>>
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 Build info
----------
golang.org/x/tools/cmd/gopls v0.1.3-cmd.gopls
    golang.org/x/tools@v0.0.0-20190903163617-be0da057c5e3 h1:1cLrGl9PL64Mzl9NATDCqFE57dVYwWOkoPXvppEnjO4=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=

Go info
-------
go version go1.13 darwin/amd64

GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/user/Library/Caches/go-build"
GOENV="/Users/user/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/user/src/project"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/user/src/project/src/github.com/project/web/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/_l/9yb78fmx0jzb8khycvrzw3qw0000gn/T/go-build259944734=/tmp/go-build -gno-record-gcc-switches -fno-common"
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 19.403537ms for GOROOT= GOPATH=/Users/user/src/project GO111MODULE=on PWD=/Users/user/src/project/src/github.com/project/web go "env" "GOMOD", stderr: <<>>
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 199.174653ms for GOROOT= GOPATH=/Users/user/src/project GO111MODULE=on PWD=/Users/user/src/project/src/github.com/project/web go "list" "-m" "-json" "all", stderr: <<>>
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 215.750697ms for GOROOT= GOPATH=/Users/user/src/project GO111MODULE=on PWD=/Users/user/src/project/src/github.com/project/web go "list" "-e" "-json" "-compiled=true" "-test=true" "-export=false" "-deps=true" "-find=false" "--" "/Users/user/src/project/src/github.com/project/web/main/goplsbug", stderr: <<>>
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 go/packages.Load
	packages = 1
2019/09/04 01:02:15 Info:2019/09/04 01:02:15 go/packages.Load
	package = github.com/project/web/main/goplsbug
	files = [/Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go]
/Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go:6:2-13: undeclared name: log
/Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go:3:8-13: "fmt" imported but not used
  • gopls logs from when the issue occurred, as well as a timestamp for when the issue began to occur. See the instructions below for information on how to capture gopls logs.
[Trace - 00:54:51.957 AM] Received response 'textDocument/codeAction - (46)' in 205569ms.
Result: [{"title":"Organize Imports","kind":"source.organizeImports","edit":{"changes":{"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go":[{"range":{"start":{"line":2,"character":0},"end":{"line":3,"character":0}},"newText":""},{"range":{"start":{"line":3,"character":0},"end":{"line":3,"character":0}},"newText":"import \"log\"\n"}]}}}]


[Trace - 00:54:51.957 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","diagnostics":[{"range":{"start":{"line":5,"character":1},"end":{"line":5,"character":12}},"severity":1,"source":"LSP","message":"undeclared name: log"},{"range":{"start":{"line":2,"character":7},"end":{"line":2,"character":12}},"severity":1,"source":"LSP","message":"\"fmt\" imported but not used"}]}```

@stamblerre
Copy link
Contributor

I'm not able to reproduce this on master. Can you try go get golang.org/x/tools/gopls@master and see if the issue still exists?

@ucirello
Copy link
Contributor Author

ucirello commented Sep 4, 2019

It works better with gopls@master - but it still fails in a similar case. All I needed to do was one of the two. Change back and forth between fmt and log; eventually it fails. The other way to get a more consistent failure was to add spew.Dump (the log shows it can resolve spew) and then gopls daemon gets stuck again.

@ucirello
Copy link
Contributor Author

ucirello commented Sep 4, 2019

package main

import (
	"log"
)

func main() {
	fmt.Println(42)
	spew.Dump(42)
}

gopls correctly stops - it can't resolve spew. But then it cannot recover from:

package main

import (
	"log"
)

func main() {
	fmt.Println(42)
	_=errors.New
}

If I restart gopls daemon, it works.

@stamblerre
Copy link
Contributor

Is it failing with context canceled errors? In that case, it might be a different issue.

@ucirello
Copy link
Contributor Author

ucirello commented Sep 4, 2019

This is the log:

[Info  - 8:31:59 PM] 2019/09/04 20:31:59 no signature help
	At = {0xc000228300 2820980 2820980}
	Failure = cannot find an enclosing function
[Trace - 8:31:59 PM] Received notification 'textDocument/publishDiagnostics' in 1ms.
Params: {"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":10}},"severity":1,"source":"LSP","message":"undeclared name: spew"}]}

[Info  - 8:31:59 PM] 2019/09/04 20:31:59 no signature help
	At = {0xc000228300 2820980 2820980}
	Failure = cannot find an enclosing function
[Trace - 8:31:59 PM] Received notification 'textDocument/publishDiagnostics' in 1ms.
Params: {"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":10}},"severity":1,"source":"LSP","message":"undeclared name: spew"}]}


[Trace - 8:32:12 PM] Received response 'textDocument/codeAction - (35)' in 0ms.
Params: [{"title":"Organize Imports","kind":"source.organizeImports","edit":{"changes":{"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\n"},{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\t\"github.com/davecgh/go-spew/spew\"\n"}]}}}]


[Trace - 8:32:12 PM] Sending notification 'textDocument/codeAction' in 22519ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go"},"range":{"start":{"line":8,"character":14},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}


[Trace - 8:32:22 PM] Received response 'textDocument/codeAction - (36)' in 0ms.
Params: [{"title":"Add import:  \"github.com/davecgh/go-spew/spew\"","kind":"quickfix","diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":10}},"severity":1,"source":"LSP","message":"undeclared name: spew"}],"edit":{"changes":{"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\n"},{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\t\"github.com/davecgh/go-spew/spew\"\n"}]}}},{"title":"Organize Imports","kind":"source.organizeImports","edit":{"changes":{"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\n"},{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\t\"github.com/davecgh/go-spew/spew\"\n"}]}}}]


[Trace - 8:32:22 PM] Sending notification 'textDocument/codeAction' in 32726ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go"},"range":{"start":{"line":0,"character":0},"end":{"line":10,"character":0}},"context":{"diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":10}},"message":"undeclared name: spew","severity":1,"source":"LSP"}]}}


[Trace - 8:32:22 PM] Received response 'textDocument/documentLink - (37)' in 0ms.
Params: [{"range":{"start":{"line":3,"character":1},"end":{"line":3,"character":6}},"target":"https://godoc.org/fmt"}]


[Trace - 8:32:22 PM] Sending notification 'textDocument/documentLink' in 32648ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go"}}


[Trace - 8:32:22 PM] Sending notification '$/cancelRequest' in 32396ms.
Params: {"id":27}


[Trace - 8:32:22 PM] Sending notification '$/cancelRequest' in 27853ms.
Params: {"id":34}


[Trace - 8:32:22 PM] Sending notification '$/cancelRequest' in 27606ms.
Params: {"id":35}


[Trace - 8:32:22 PM] Received response 'textDocument/documentSymbol - (38)' in 0ms.
Params: [{"name":"main","detail":"()","kind":12,"range":{"start":{"line":6,"character":0},"end":{"line":9,"character":1}},"selectionRange":{"start":{"line":6,"character":5},"end":{"line":6,"character":9}}}]


[Trace - 8:32:22 PM] Sending notification 'textDocument/documentSymbol' in 32397ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go"}}


[Trace - 8:32:31 PM] Received response 'textDocument/codeAction - (39)' in 0ms.
Params: [{"title":"Organize Imports","kind":"source.organizeImports","edit":{"changes":{"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go":[{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\n"},{"range":{"start":{"line":4,"character":0},"end":{"line":4,"character":0}},"newText":"\t\"github.com/davecgh/go-spew/spew\"\n"}]}}}]


[Trace - 8:32:31 PM] Sending notification 'textDocument/codeAction' in 34562ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go"},"range":{"start":{"line":8,"character":14},"end":{"line":8,"character":14}},"context":{"diagnostics":[]}}


[Trace - 8:32:31 PM] Sending notification 'textDocument/didChange' in 34191ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","version":28},"contentChanges":[{"range":{"start":{"line":8,"character":14},"end":{"line":8,"character":14}},"rangeLength":0,"text":" "}]}


[Trace - 8:32:31 PM] Sending notification '$/cancelRequest' in 34191ms.
Params: {"id":36}


[Trace - 8:32:31 PM] Sending notification '$/cancelRequest' in 34191ms.
Params: {"id":39}


[Trace - 8:32:31 PM] Sending notification '$/cancelRequest' in 33491ms.
Params: {"id":38}


[Trace - 8:32:31 PM] Received notification 'textDocument/publishDiagnostics' in 0ms.
Params: {"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","diagnostics":[{"range":{"start":{"line":8,"character":1},"end":{"line":8,"character":10}},"severity":1,"source":"LSP","message":"undeclared name: spew"}]}


[Trace - 8:32:31 PM] Received response 'textDocument/documentSymbol - (40)' in 0ms.
Params: [{"name":"main","detail":"()","kind":12,"range":{"start":{"line":6,"character":0},"end":{"line":9,"character":1}},"selectionRange":{"start":{"line":6,"character":5},"end":{"line":6,"character":9}}}]


[Trace - 8:32:31 PM] Sending notification 'textDocument/documentSymbol' in 33491ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go"}}


[Trace - 8:32:31 PM] Received response 'textDocument/documentLink - (41)' in 0ms.
Params: [{"range":{"start":{"line":3,"character":1},"end":{"line":3,"character":6}},"target":"https://godoc.org/fmt"}]


[Trace - 8:32:31 PM] Sending notification 'textDocument/documentLink' in 33196ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go"}}


[Trace - 8:32:31 PM] Sending notification 'textDocument/didSave' in 26954ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","version":28}}


[Trace - 8:32:31 PM] Sending notification 'textDocument/didChange' in 26954ms.
Params: {"textDocument":{"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","version":29},"contentChanges":[{"range":{"start":{"line":8,"character":14},"end":{"line":8,"character":15}},"rangeLength":1,"text":""}]}

@ucirello
Copy link
Contributor Author

ucirello commented Sep 4, 2019

It seems it keeps trying to resolve to spew even after it's removed from the code.

@ucirello
Copy link
Contributor Author

ucirello commented Sep 4, 2019

I manage to get context canceled errors:

Error - 8:39:21 PM] send textDocument/publishDiagnostics context canceled


[Error - 8:39:21 PM] 2019/09/04 20:39:21 failed to compute diagnostics: no CheckPackageHandles for file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
	file = file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
[Trace - 8:39:21 PM] Received notification 'textDocument/publishDiagnostics' in 0ms.
Params: {"uri":"file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go","diagnostics":[{"range":{"start":{"line":8,"character":2},"end":{"line":8,"character":11}},"severity":1,"source":"LSP","message":"undeclared name: errors"}]}


[Error - 8:39:21 PM] 2019/09/04 20:39:21 failed to check package: context canceled
[Error - 8:39:21 PM] 2019/09/04 20:39:21 failed to compute diagnostics: no CheckPackageHandles for file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
	file = file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
[Error - 8:39:21 PM] 2019/09/04 20:39:21 failed to compute diagnostics: no CheckPackageHandles for file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
	file = file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
[Error - 8:39:21 PM] 2019/09/04 20:39:21 failed to compute diagnostics: no CheckPackageHandles for file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
	file = file:///Users/user/src/project/src/github.com/project/web/main/goplsbug/main.go
[Error - 8:39:21 PM] 2019/09/04 20:39:21 failed to check package: context canceled
[Error - 8:39:21 PM] 2019/09/04 20:39:21 failed to check package: context canceled
[Info  - 8:39:21 PM] 2019/09/04 20:39:21 no completions found
	At = {8 9}
	Failure = cannot resolve errors

@muirdm
Copy link

muirdm commented Sep 5, 2019

I can reproduce gopls getting stuck after running organizeImports in the above example. There is a mutex deadlock reminiscent of #33992:

1 @ 0x1030baf 0x1040f29 0x1040eff 0x1040c9d 0x1073469 0x155a2e2 0x155c113 0x155b0d4 0x155b4d3 0x137ee54 0x15458e9 0x15543a4 0x105d7e1
#	0x1040c9c	sync.runtime_SemacquireMutex+0x3c						/usr/local/go/src/runtime/sema.go:71
#	0x1073468	sync.(*Mutex).Lock+0x108							/usr/local/go/src/sync/mutex.go:134
#	0x155a2e1	golang.org/x/tools/internal/lsp/cache.(*fileBase).Handle+0x41			/Users/muir/projects/tools/internal/lsp/cache/file.go:58
#	0x155c112	golang.org/x/tools/internal/lsp/cache.(*goFile).isDirty+0x102			/Users/muir/projects/tools/internal/lsp/cache/gofile.go:233
#	0x155b0d3	golang.org/x/tools/internal/lsp/cache.(*goFile).GetCheckPackageHandles+0x163	/Users/muir/projects/tools/internal/lsp/cache/gofile.go:122
#	0x155b4d2	golang.org/x/tools/internal/lsp/cache.(*goFile).GetCheckPackageHandle+0x42	/Users/muir/projects/tools/internal/lsp/cache/gofile.go:142
#	0x137ee53	golang.org/x/tools/internal/lsp/source.Diagnostics+0x1b3			/Users/muir/projects/tools/internal/lsp/source/diagnostics.go:73
#	0x15458e8	golang.org/x/tools/internal/lsp.(*Server).Diagnostics+0x1f8			/Users/muir/projects/tools/internal/lsp/diagnostics.go:30
#	0x15543a3	golang.org/x/tools/internal/lsp.(*Server).didChange.func1+0xf3			/Users/muir/projects/tools/internal/lsp/text_synchronization.go:90

1 @ 0x1030baf 0x1040f29 0x1040eff 0x1040c9d 0x1073469 0x1567714 0x1567401 0x156a01e 0x1568d90 0x156999d 0x1563bc0 0x156704d 0x1551429 0x154e3d9 0x13236d7 0x118699a 0x105d7e1
#	0x1040c9c	sync.runtime_SemacquireMutex+0x3c					/usr/local/go/src/runtime/sema.go:71
#	0x1073468	sync.(*Mutex).Lock+0x108						/usr/local/go/src/sync/mutex.go:134
#	0x1567713	golang.org/x/tools/internal/lsp/cache.(*view).remove+0x273		/Users/muir/projects/tools/internal/lsp/cache/view.go:416
#	0x1567400	golang.org/x/tools/internal/lsp/cache.(*goFile).invalidateContent+0x350	/Users/muir/projects/tools/internal/lsp/cache/view.go:382
#	0x156a01d	golang.org/x/tools/internal/lsp/cache.(*view).getFile.func1+0x4d	/Users/muir/projects/tools/internal/lsp/cache/view.go:491
#	0x1568d8f	golang.org/x/tools/internal/lsp/cache.(*WatchMap).Notify+0x14f		/Users/muir/projects/tools/internal/lsp/cache/watcher.go:60
#	0x156999c	golang.org/x/tools/internal/lsp/cache.(*session).SetOverlay.func1+0x6c	/Users/muir/projects/tools/internal/lsp/cache/session.go:259
#	0x1563bbf	golang.org/x/tools/internal/lsp/cache.(*session).SetOverlay+0x1ff	/Users/muir/projects/tools/internal/lsp/cache/session.go:277
#	0x156704c	golang.org/x/tools/internal/lsp/cache.(*view).SetContent+0x15c		/Users/muir/projects/tools/internal/lsp/cache/view.go:355
#	0x1551428	golang.org/x/tools/internal/lsp.(*Server).didChange+0x238		/Users/muir/projects/tools/internal/lsp/text_synchronization.go:71
#	0x154e3d8	golang.org/x/tools/internal/lsp.(*Server).DidChange+0x48		/Users/muir/projects/tools/internal/lsp/server.go:156
#	0x13236d6	golang.org/x/tools/internal/lsp/protocol.serverHandler.Deliver+0x2606	/Users/muir/projects/tools/internal/lsp/protocol/tsserver.go:122
#	0x1186999	golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1+0x139		/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:370

@stamblerre
Copy link
Contributor

stamblerre commented Sep 5, 2019

@muirrn: Is this on master?

Edit: Nevermind, I see the issue. thanks

@gopherbot
Copy link

Change https://golang.org/cl/193718 mentions this issue: internal/lsp: fix deadlock between f.mu and f.handleMu

gopherbot pushed a commit to golang/tools that referenced this issue Sep 5, 2019
This change propagates the file handle through the type-checking
process, ensuring that the same handle is used throughout. It also
removes the ordering constraint that f.mu needs to be acquired before
f.handleMu. To make this more correct, we should associate a cached
package only with a FileHandle, but this relies on correct cache
invalidation, so that will be addressed in future changes.

Updates golang/go#34052

Change-Id: I6645046bfd15c882619a7f01f9b48c838de42a30
Reviewed-on: https://go-review.googlesource.com/c/tools/+/193718
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@stamblerre stamblerre added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 9, 2019
@stamblerre
Copy link
Contributor

@ucirello: Is this still an issue for you with the latest version of gopls?

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 4, 2019
@stamblerre stamblerre modified the milestones: Unreleased, gopls v1.0 Dec 4, 2019
@ucirello
Copy link
Contributor Author

ucirello commented Dec 4, 2019

not anymore - problem fixed.

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants