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/cmd/gopls: panic after deleting file #32791

Closed
muirdm opened this issue Jun 26, 2019 · 3 comments
Closed

x/tools/cmd/gopls: panic after deleting file #32791

muirdm opened this issue Jun 26, 2019 · 3 comments

Comments

@muirdm
Copy link

@muirdm muirdm commented Jun 26, 2019

I see the below panic consistently after deleting a file from Emacs (gopls 252024b):

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

goroutine 53 [running]:
golang.org/x/tools/internal/lsp/cache.(*nativeFileSystem).GetFile(0x1bc53c0, 0xc000b5fec0, 0x26, 0xc00022d270, 0xc00022d2a8)
	/Users/muir/projects/tools/internal/lsp/cache/external.go:27 +0x70
golang.org/x/tools/internal/lsp/cache.(*cache).GetFile(0xc0001f13c0, 0xc000b5fec0, 0x26, 0x0, 0xc00022d2f8)
	/Users/muir/projects/tools/internal/lsp/cache/cache.go:59 +0x51
golang.org/x/tools/internal/lsp/cache.(*session).GetFile(0xc00023c000, 0xc000b5fec0, 0x26, 0xc00022d3e8, 0x11139c7)
	/Users/muir/projects/tools/internal/lsp/cache/session.go:230 +0x97
golang.org/x/tools/internal/lsp/cache.(*fileBase).Handle(0xc0020d0dc0, 0x17823e0, 0xc0024b8210, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/file.go:63 +0xd0
golang.org/x/tools/internal/lsp/cache.(*view).parseImports(0xc0000a7a00, 0x17823e0, 0xc0024b8210, 0xc0020d0dc0, 0xc000b5fec7)
	/Users/muir/projects/tools/internal/lsp/cache/load.go:151 +0x75
golang.org/x/tools/internal/lsp/cache.(*view).checkMetadata(0xc0000a7a00, 0x17823e0, 0xc0024b8210, 0xc0020d0dc0, 0x3, 0xc000038f70, 0xc000038f00, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/load.go:94 +0x6a
golang.org/x/tools/internal/lsp/cache.(*view).loadParseTypecheck(0xc0000a7a00, 0x17823e0, 0xc0024b8210, 0xc0020d0dc0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/load.go:29 +0xff
golang.org/x/tools/internal/lsp/cache.(*goFile).GetPackages(0xc0020d0dc0, 0x17823e0, 0xc0024b8210, 0x0, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/gofile.go:97 +0x100
golang.org/x/tools/internal/lsp/cache.(*goFile).GetPackage(0xc0020d0dc0, 0x17823e0, 0xc0024b8210, 0x178a420, 0xc0020d0dc0)
	/Users/muir/projects/tools/internal/lsp/cache/gofile.go:118 +0x4c
golang.org/x/tools/internal/lsp.(*Server).didClose(0xc0001f6780, 0x17823e0, 0xc0024b8210, 0xc000d52cb0, 0x0, 0xc0021d2640)
	/Users/muir/projects/tools/internal/lsp/text_synchronization.go:123 +0x1f9
golang.org/x/tools/internal/lsp.(*Server).DidClose(0xc0001f6780, 0x17823e0, 0xc0024b8210, 0xc000d52cb0, 0xc000d52cb0, 0x0)
	/Users/muir/projects/tools/internal/lsp/server.go:155 +0x49
golang.org/x/tools/internal/lsp/protocol.serverHandler.func1(0x17823e0, 0xc0024b8210, 0xc00023a000, 0xc001961020)
	/Users/muir/projects/tools/internal/lsp/protocol/tsserver.go:122 +0x1c2f
golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc0001ff1a0, 0xc00023a000)
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:288 +0x189
created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:278 +0xba

/cc @stamblerre

@gopherbot gopherbot added this to the Unreleased milestone Jun 26, 2019
@gopherbot gopherbot added the gopls label Jun 26, 2019
@gopherbot
Copy link

@gopherbot gopherbot commented Jun 26, 2019

Change https://golang.org/cl/183628 mentions this issue: internal/lsp: support a file belonging to multiple packages

@muirdm
Copy link
Author

@muirdm muirdm commented Jun 26, 2019

Still seeing this on master (cf32dd8) after deleting a file:

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

goroutine 53 [running]:
golang.org/x/tools/internal/lsp/cache.(*nativeFileSystem).GetFile(0x1bc33c0, 0xc00043e030, 0x26, 0xc000263270, 0xc0002632a8)
	/Users/muir/projects/tools/internal/lsp/cache/external.go:31 +0x70
golang.org/x/tools/internal/lsp/cache.(*cache).GetFile(0xc0002123c0, 0xc00043e030, 0x26, 0x0, 0xc0002632f8)
	/Users/muir/projects/tools/internal/lsp/cache/cache.go:59 +0x51
golang.org/x/tools/internal/lsp/cache.(*session).GetFile(0xc000234000, 0xc00043e030, 0x26, 0xc0002633e8, 0x11139c7)
	/Users/muir/projects/tools/internal/lsp/cache/session.go:234 +0x97
golang.org/x/tools/internal/lsp/cache.(*fileBase).Handle(0xc000416140, 0x1780ac0, 0xc000406ff0, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/file.go:63 +0xd0
golang.org/x/tools/internal/lsp/cache.(*view).parseImports(0xc0002704e0, 0x1780ac0, 0xc000406ff0, 0xc000416140, 0xc00043e037)
	/Users/muir/projects/tools/internal/lsp/cache/load.go:151 +0x75
golang.org/x/tools/internal/lsp/cache.(*view).checkMetadata(0xc0002704e0, 0x1780ac0, 0xc000406ff0, 0xc000416140, 0x3, 0xc000040070, 0xc000040000, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/load.go:94 +0x6a
golang.org/x/tools/internal/lsp/cache.(*view).loadParseTypecheck(0xc0002704e0, 0x1780ac0, 0xc000406ff0, 0xc000416140, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/load.go:29 +0xff
golang.org/x/tools/internal/lsp/cache.(*goFile).GetPackages(0xc000416140, 0x1780ac0, 0xc000406ff0, 0x0, 0x0, 0x0)
	/Users/muir/projects/tools/internal/lsp/cache/gofile.go:97 +0x100
golang.org/x/tools/internal/lsp/cache.(*goFile).GetPackage(0xc000416140, 0x1780ac0, 0xc000406ff0, 0x1788b40, 0xc000416140)
	/Users/muir/projects/tools/internal/lsp/cache/gofile.go:118 +0x4c
golang.org/x/tools/internal/lsp.(*Server).didClose(0xc0001d6600, 0x1780ac0, 0xc000406ff0, 0xc0003fa550, 0x0, 0xc000416640)
	/Users/muir/projects/tools/internal/lsp/text_synchronization.go:123 +0x1f9
golang.org/x/tools/internal/lsp.(*Server).DidClose(0xc0001d6600, 0x1780ac0, 0xc000406ff0, 0xc0003fa550, 0xc0003fa550, 0x0)
	/Users/muir/projects/tools/internal/lsp/server.go:154 +0x49
golang.org/x/tools/internal/lsp/protocol.serverHandler.func1(0x1780ac0, 0xc000406ff0, 0xc000232000, 0xc000310420)
	/Users/muir/projects/tools/internal/lsp/protocol/tsserver.go:122 +0x1c2f
golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc0001c2de0, 0xc000232000)
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:288 +0x189
created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
	/Users/muir/projects/tools/internal/jsonrpc2/jsonrpc2.go:278 +0xba
@gopherbot
Copy link

@gopherbot gopherbot commented Jun 26, 2019

Change https://golang.org/cl/183984 mentions this issue: internal/lsp: fix panic in computing file version

gopherbot pushed a commit to golang/tools that referenced this issue Jun 26, 2019
Fixes golang/go#32791

Change-Id: I04fc3de5ed94137424a32f3e7200ba72d3913329
Reviewed-on: https://go-review.googlesource.com/c/tools/+/183984
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
@golang golang locked and limited conversation to collaborators Jun 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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