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: cache panic inheriting destroyed handle #41415

Open
findleyr opened this issue Sep 16, 2020 · 3 comments
Open

x/tools/gopls: cache panic inheriting destroyed handle #41415

findleyr opened this issue Sep 16, 2020 · 3 comments
Labels
Milestone

Comments

@findleyr
Copy link
Contributor

@findleyr findleyr commented Sep 16, 2020

Just got a concerning panic from the generational cache: panic: inheriting destroyed handle "bf90d6e270fcf98967555c6a0aba69594d7e60ab389281fa22a86d7efcbcbe3e" into generation v12/1291

This is running in daemon mode. I'm sure this is less likely to occur in standalone mode.

Logs were not revealing, but I have them if we think they'd be useful.

2020/09/15 15:44:53 Gopls daemon: listening on tcp network, address :8091...         
2020/09/15 15:45:52 Session 1: connected                                                                                                          
2020/09/15 15:45:52 Session 1: got handshake. Logfile: "/tmp/nvimX6R61U/gopls-1993215.log", Debug addr: ""
2020/09/15 16:06:28 Session 1: exited                                                                                                             
2020/09/15 16:06:42 Session 2: connected                                                                                                          
2020/09/15 16:06:42 Session 2: got handshake. Logfile: "/tmp/nvim5tEFoD/gopls-2013699.log", Debug addr: ""
2020/09/15 21:31:10 Session 3: connected                                                                                                          
2020/09/15 21:31:10 Session 3: got handshake. Logfile: "/tmp/nvimlzMyB4/gopls-2211163.log", Debug addr: ""                            
2020/09/15 21:35:04 Session 3: exited                                                                                                             
2020/09/15 21:35:05 Session 4: connected                                                                                                          
2020/09/15 21:35:05 Session 4: got handshake. Logfile: "/tmp/nvimlzMyB4/gopls-2216889.log", Debug addr: ""
2020/09/15 21:38:24 Session 4: exited                                                                                                             
2020/09/15 21:40:30 Session 5: connected                                                                                                          
2020/09/15 21:40:30 Session 5: got handshake. Logfile: "/tmp/nvimISaKHd/gopls-2220366.log", Debug addr: ""
2020/09/15 21:49:27 Session 5: exited                                                                                                             
2020/09/15 21:51:25 Session 6: connected                                 
2020/09/15 21:51:25 Session 6: got handshake. Logfile: "/tmp/nvimoERVLy/gopls-2263969.log", Debug addr: ""
2020/09/15 22:04:31 Session 6: exited                                    
2020/09/15 22:07:49 Session 7: connected                                 
2020/09/15 22:07:49 Session 7: got handshake. Logfile: "/tmp/nvimwdMZ3S/gopls-2323381.log", Debug addr: ""
2020/09/15 22:08:35 Session 7: exited                                    
2020/09/15 22:09:37 Session 8: connected                                 
2020/09/15 22:09:37 Session 8: got handshake. Logfile: "/tmp/nvimMILvvC/gopls-2325071.log", Debug addr: ""
2020/09/15 23:11:39 Session 8: exited 
panic: inheriting destroyed handle "bf90d6e270fcf98967555c6a0aba69594d7e60ab389281fa22a86d7efcbcbe3e" into generation v12/1291
                                                                                                                                                  
goroutine 1194992 [running]:                                            
golang.org/x/tools/internal/memoize.(*Generation).Inherit(0xc0c1c22db0, 0xc034d75ce0)       
        /usr/local/google/home/rfindley/src/tools/internal/memoize/memoize.go:231 +0x1a5                                              
golang.org/x/tools/internal/lsp/cache.(*snapshot).clone(0xc03563e0b0, 0x103b300, 0xc06f7be0c0, 0xc0bcfe4a80, 0xc06f7be000, 0x0)
        /usr/local/google/home/rfindley/src/tools/internal/lsp/cache/snapshot.go:1018 +0x1be7                                             
golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent(0xc000324380, 0x103ad00, 0xc0b29f8090, 0xc0bcfe4a80, 0x0, 0x0, 0x0, 0x0)
        /usr/local/google/home/rfindley/src/tools/internal/lsp/cache/view.go:777 +0x14c                                                           
golang.org/x/tools/internal/lsp/cache.(*Session).DidModifyFiles(0xc046dac540, 0x103ad00, 0xc0b29f8090, 0xc0297c04b0, 0x1, 0x1, 0xc09db740f0, 0xc02
b8d3800, 0xb, 0x10, ...)                                                                                                                          
        /usr/local/google/home/rfindley/src/tools/internal/lsp/cache/session.go:517 +0x8cc
golang.org/x/tools/internal/lsp.(*Server).didModifyFiles(0xc03c669540, 0x103ad00, 0xc0b29f8090, 0xc0297c04b0, 0x1, 0x1, 0x4, 0x0, 0x0)
        /usr/local/google/home/rfindley/src/tools/internal/lsp/text_synchronization.go:191 +0x125
golang.org/x/tools/internal/lsp.(*Server).didClose(0xc03c669540, 0x103ad00, 0xc0b29f8090, 0xc026efb730, 0x0, 0xc03563e9a0)
        /usr/local/google/home/rfindley/src/tools/internal/lsp/text_synchronization.go:168 +0x134
golang.org/x/tools/internal/lsp.(*Server).DidClose(0xc03c669540, 0x103ad00, 0xc0b29f8090, 0xc026efb730, 0xc026efb730, 0x0)
        /usr/local/google/home/rfindley/src/tools/internal/lsp/server_gen.go:52 +0x49
golang.org/x/tools/internal/lsp/protocol.serverDispatch(0x103ad00, 0xc0b29f8090, 0x104e880, 0xc03c669540, 0xc0bcfe49f0, 0x7fc9c0ae4a98, 0xc0b29f80
30, 0x0, 0x1026f40, 0xc03563e840)                                                                                                                 
        /usr/local/google/home/rfindley/src/tools/internal/lsp/protocol/tsserver.go:127 +0x28c7
golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0x103ad00, 0xc0b29f8090, 0xc0bcfe49f0, 0x7fc9c0ae4a98, 0xc0b29f8030, 0x18614338c55f, 
0x150a220)                                                               
        /usr/local/google/home/rfindley/src/tools/internal/lsp/protocol/protocol.go:63 +0xc5
golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0x103ad00, 0xc0b29f8090, 0xc0bcfe49f0, 0x7fc9c0ae4a98, 0xc0b29f8030, 0x0, 0x0)
        /usr/local/google/home/rfindley/src/tools/internal/lsp/lsprpc/lsprpc.go:557 +0x452
golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0x103ad00, 0xc0b29f8090, 0xc012f6a460, 0x7fc9c0ae4a98, 0xc0b29f8030, 0xc0529a4540, 0x1
c)                                                                                                                                                
        /usr/local/google/home/rfindley/src/tools/internal/jsonrpc2/handler.go:35 +0xcf
golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc0b0a04000, 0xc0b29f8b10, 0xc0715ee6d0, 0x103ad00, 0xc0b29f8090, 0xc012f6a460, 0x7fc9c
0ae4a98, 0xc0b29f8030)                                                                                                                            
        /usr/local/google/home/rfindley/src/tools/internal/jsonrpc2/handler.go:103 +0x86
created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1       
        /usr/local/google/home/rfindley/src/tools/internal/jsonrpc2/handler.go:100 +0x173

Perhaps a reasonable action would be to improve the error message above to make this easier to diagnose.

cc @heschik @stamblerre

@gopherbot gopherbot added this to the Unreleased milestone Sep 16, 2020
@heschik
Copy link
Contributor

@heschik heschik commented Sep 16, 2020

I'm very open to suggestions on how to improve the error message, but this is fundamentally very tricky stuff :-/

Did this happen as you exited an editor? My best guess is that we tried to deal with a DidClose on a view that had been shut down. That's a client bug, but probably one we should guard against.

@findleyr
Copy link
Contributor Author

@findleyr findleyr commented Sep 16, 2020

I'm very open to suggestions on how to improve the error message

Any metadata describing the handle would be a start. Given how few distinct handles we have, perhaps this could be threaded through.

From our analysis, we think this was in the s.packages loop of snapshot.clone.

@gopherbot
Copy link

@gopherbot gopherbot commented Sep 16, 2020

Change https://golang.org/cl/255357 mentions this issue: internal/memoize: show key type in panics

gopherbot pushed a commit to golang/tools that referenced this issue Sep 16, 2020
gopls uses a lot of keys that are just strings, which print without any
type information. Include the type of the key explicitly.

Updates golang/go#41415.

Change-Id: I01cfc685184e7b44c1f562b6536f173da5ae4830
Reviewed-on: https://go-review.googlesource.com/c/tools/+/255357
Trust: Heschi Kreinick <heschi@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v1.0.0 Sep 20, 2020
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
4 participants
You can’t perform that action at this time.