Skip to content

x/tools/gopls: imports: nil panic in ClearModuleInfo (via telemetry) #66490

@adonovan

Description

@adonovan

This stack pUwreg was reported by telemetry:

ClearModuleInfo:+4 is:

		if resolverErr == nil {
			<-r.scanSema // acquire (guards caches)                            HERE
			resolver.moduleCacheCache = r.moduleCacheCache
			resolver.otherCache = r.otherCache
			r.scanSema <- struct{}{} // release
		}

but I don't see at a glance how a ModuleResolver can be constructed without a valid scanSema.

Possibly related to https://go.dev/cl/561235?

crash/crash
runtime.gopanic:+69
runtime.panicmem:=261
runtime.sigpanic:+19
golang.org/x/tools/internal/imports.(*ProcessEnv).ClearModuleInfo:+4
golang.org/x/tools/gopls/internal/cache.(*importsState).runProcessEnvFunc:+25
golang.org/x/tools/gopls/internal/cache.(*Snapshot).RunProcessEnvFunc:=439
golang.org/x/tools/gopls/internal/golang.allImportsFixes:+4
golang.org/x/tools/gopls/internal/golang.CodeActions:+13
golang.org/x/tools/gopls/internal/server.(*server).CodeAction:+95
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+160
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0
golang.org/x/tools/[email protected] devel darwin/arm64 vscode (1)

Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/importsgopls/telemetry-wins

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions