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: nil pointer in analysis #35339

Closed
ilanpillemer opened this issue Nov 4, 2019 · 35 comments
Closed

x/tools/gopls: nil pointer in analysis #35339

ilanpillemer opened this issue Nov 4, 2019 · 35 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.
Milestone

Comments

@ilanpillemer
Copy link

ilanpillemer commented Nov 4, 2019

Please answer these questions before submitting your issue. Thanks!

What did you do?

I had gopls running

What did you expect to see?

gopls doing stuff

What did you see instead?

gopls doing stuff and restarting

stack trace of

[Error - 10:36:37.252 AM] Received #2 ToUTF16Column: column is invalid (-1)


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

goroutine 92 [running]:
golang.org/x/tools/internal/lsp/cache.(*actionHandle).analyze(0xc0025b3360, 0x19b0e20, 0xc000270a80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:149 +0x65
golang.org/x/tools/internal/lsp/cache.(*snapshot).Analyze(0xc0000de820, 0x19b0e20, 0xc000270a80, 0xc0002c47c0, 0x32, 0xc000d83000, 0x88, 0x100, 0x0, 0x101, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:39 +0x25e
golang.org/x/tools/internal/lsp/source.analyses(0x19b0e20, 0xc000270a80, 0x19b3fe0, 0xc0000de820, 0x19b3fa0, 0xc000383b30, 0x0, 0xc0025bb650, 0x1, 0x1)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:169 +0x294
golang.org/x/tools/internal/lsp/source.Diagnostics(0x19b0e20, 0xc000270a80, 0x19c1540, 0xc00032e900, 0x239a240, 0xc000218340, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:87 +0x971
golang.org/x/tools/internal/lsp.(*Server).diagnostics(0xc00029cf00, 0x19c1540, 0xc00032e900, 0xc0002f22d0, 0x4b, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/diagnostics.go:30 +0x2e0
created by golang.org/x/tools/internal/lsp.(*Server).didChange
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/text_synchronization.go:82 +0x373
[Trace - 10:36:50.040 AM] Sending request 'initialize - (1)'.
Params: {"processId":0,"rootUri":"file:///","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{},"didChangeConfiguration":{},"didChangeWatchedFiles":{},"symbol":{},"executeCommand":{},"workspaceFolders":true},"textDocument":{"synchronization":{},"completion":{},"hover":{},"signatureHelp":{},"declaration":{},"definition":{},"typeDefinition":{},"implementation":{},"references":{},"documentHighlight":{},"documentSymbol":{"hierarchicalDocumentSymbolSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["source.organizeImports"]}}},"formatting":{},"rangeFormatting":{},"onTypeFormatting":{},"codeLens":{},"documentLink":{},"rename":{},"publishDiagnostics":{},"colorProvider":{},"foldingRange":{},"selectionRange":{}}},"initializationOptions":{"hoverKind":"FullDocumentation","staticcheck":true},"workspaceFolders":[{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm"},{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/bx-pipe","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm/bx-pipe"},{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler"},{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bxrepl/cmd/bxrepl","name":"/Users/ilanpillemer/Repos/bxbdigital/bxrepl/cmd/bxrepl"}]}

another example

[Trace - 10:36:34.203 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/04 10:36:34 go/packages.Load\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tfiles = [/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/bx.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/compilerflags.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/fieldtype_string.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/interpreter.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/parser.go /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/symbols.go]"}


[Trace - 10:36:34.304 AM] Received response 'textDocument/completion - (2)' in 299ms.
Result: {"isIncomplete":false,"items":[]}


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

goroutine 31 [running]:
golang.org/x/tools/internal/lsp/cache.(*actionHandle).analyze(0xc002542d20, 0x19b0e20, 0xc000282a20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:149 +0x65
golang.org/x/tools/internal/lsp/cache.(*snapshot).Analyze(0xc00025c190, 0x19b0e20, 0xc000282a20, 0xc0001d4f00, 0x32, 0xc001ced800, 0x88, 0x100, 0x0, 0x101, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/cache/analysis.go:39 +0x25e
golang.org/x/tools/internal/lsp/source.analyses(0x19b0e20, 0xc000282a20, 0x19b3fe0, 0xc00025c190, 0x19b3fa0, 0xc00024d0e0, 0x0, 0xc0023810b0, 0x1, 0x1)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:169 +0x294
golang.org/x/tools/internal/lsp/source.Diagnostics(0x19b0e20, 0xc000282a20, 0x19c1540, 0xc000001980, 0x5400008, 0xc00018c580, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/source/diagnostics.go:87 +0x971
golang.org/x/tools/internal/lsp.(*Server).diagnostics(0xc000169ce0, 0x19c1540, 0xc000001980, 0xc00003c1e0, 0x4b, 0x0, 0x0)
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/diagnostics.go:30 +0x2e0
created by golang.org/x/tools/internal/lsp.(*Server).didChange
	/Users/ilanpillemer/go/src/golang.org/x/tools/internal/lsp/text_synchronization.go:82 +0x373
[Trace - 10:36:35.026 AM] Sending request 'initialize - (1)'

Build info

golang.org/x/tools/gopls v0.1.6
    golang.org/x/tools/gopls@(devel)
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20191017151554-a3bc800455d5 => ../
    golang.org/x/xerrors@v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
    honnef.co/go/tools@v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=

Go info

go version go1.13.3 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ilanpillemer/Library/Caches/go-build"
GOENV="/Users/ilanpillemer/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="bitbucket.org/bxbdigital"
GONOSUMDB="bitbucket.org/bxbdigital"
GOOS="darwin"
GOPATH="/Users/ilanpillemer/go"
GOPRIVATE="bitbucket.org/bxbdigital"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/z4/rs3f6lcs10l9rhf6wg4vdjt80000gn/T/go-build158073267=/tmp/go-build -gno-record-gcc-switches -fno-common"
@gopherbot
Copy link

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

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Nov 4, 2019
@gopherbot
Copy link

Change https://golang.org/cl/205161 mentions this issue: internal/lsp: add additional check for analysis value

@stamblerre
Copy link
Contributor

Just mailed CL 205161 to handle this, but I'm curious about how you triggered it. Do you mind rebuilding gopls with this CL (download it by clicking the "..." in the right hand corner and choosing "Download Patch") and sharing the log output?

@stamblerre stamblerre changed the title gopls: gopls restarting repeatedly x/tools/gopls: nil pointer in analysis Nov 4, 2019
@gopherbot gopherbot added this to the Unreleased milestone Nov 4, 2019
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Nov 4, 2019
@ilanpillemer
Copy link
Author

ilanpillemer commented Nov 4, 2019

I can't work out how to download the patch.. I must be misunderstanding something.
I can only try again later tomorrow though, as have an appointment in the morning. If I were to guess at anything unusual, is I am using go generate in this package for goyacc and stringer and have a yacc y file in it with go code. And it keeps telling me the yacc file doesn't exist.. when it does.. and also after I run go generate it seems to miss the new stuff stringer creates.

gopherbot pushed a commit to golang/tools that referenced this issue Nov 4, 2019
Updates golang/go#35339

Change-Id: Ie990672b619d1844f66abf62010fe9a69daf00d9
Reviewed-on: https://go-review.googlesource.com/c/tools/+/205161
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
@stamblerre
Copy link
Contributor

I've just tagged a pre-release of gopls that has the fix in: go get golang.org/x/tools/gopls@v0.2.0-pre2 should download it now. Whenever you get a chance, please let me know if that fixed the issue.

@ilanpillemer
Copy link
Author

will do when I get back home later.

@ilanpillemer
Copy link
Author

I am still getting errors.

I changed my startup script to this (commenting out the install steps).. maybe I did this wrong?

[  "$(pgrep acme-lsp)" ] && kill `pgrep acme-lsp`
[  "$(pgrep gopls)" ] && kill `pgrep gopls`
# GO111MODULE=on go get golang.org/x/tools/gopls@latest
GO111MODULE=on go get golang.org/x/tools/gopls@v0.2.0-pre2
#go get -u golang.org/x/tools/gopls
#cd ~/go/src/golang.org/x/tools/gopls && go install

acme-lsp

and got this stack trace

[Trace - 12:21:42.121 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/cmd/main.go","diagnostics":[]}


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

goroutine 86 [running]:
golang.org/x/tools/internal/lsp/cache.(*actionHandle).analyze(0xc001fc4960, 0x19a6d20, 0xc000284870, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        /Users/ilanpillemer/go/pkg/mod/golang.org/x/tools@v0.0.0-20191105003958-c33799150868/internal/lsp/cache/analysis.go:151 +0x74
golang.org/x/tools/internal/lsp/cache.(*snapshot).Analyze(0xc00021a6e0, 0x19a6d20, 0xc000284870, 0xc000181c80, 0x32, 0xc001a79000, 0x88, 0x100, 0x0, 0x101, ...)
        /Users/ilanpillemer/go/pkg/mod/golang.org/x/tools@v0.0.0-20191105003958-c33799150868/internal/lsp/cache/analysis.go:39 +0x25e
golang.org/x/tools/internal/lsp/source.analyses(0x19a6d20, 0xc000284870, 0x19ac8a0, 0xc00021a6e0, 0x19a9f60, 0xc00021ae10, 0x0, 0xc00208a510, 0x1, 0x1)
        /Users/ilanpillemer/go/pkg/mod/golang.org/x/tools@v0.0.0-20191105003958-c33799150868/internal/lsp/source/diagnostics.go:169 +0x294
golang.org/x/tools/internal/lsp/source.Diagnostics(0x19a6d20, 0xc000284870, 0x19b8960, 0xc0000c6000, 0x27c6840, 0xc0003fa040, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/ilanpillemer/go/pkg/mod/golang.org/x/tools@v0.0.0-20191105003958-c33799150868/internal/lsp/source/diagnostics.go:87 +0x971
golang.org/x/tools/internal/lsp.(*Server).diagnostics(0xc000296840, 0x19b8960, 0xc0000c6000, 0xc000468000, 0x4e, 0x0, 0x0)
        /Users/ilanpillemer/go/pkg/mod/golang.org/x/tools@v0.0.0-20191105003958-c33799150868/internal/lsp/diagnostics.go:30 +0x2e0
created by golang.org/x/tools/internal/lsp.(*Server).didOpen
        /Users/ilanpillemer/go/pkg/mod/golang.org/x/tools@v0.0.0-20191105003958-c33799150868/internal/lsp/text_synchronization.go:34 +0x1c8
[Trace - 12:21:57.781 PM] Sending request 'initialize - (1)'.
Params: {"processId":0,"rootUri":"file:///","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{},"didChangeConfiguration":{},"didChangeWatchedFiles":{},"symbol":{},"executeCommand":{},"workspaceFolders":true},"textDocument":{"synchronization
":{},"completion":{},"hover":{},"signatureHelp":{},"declaration":{},"definition":{},"typeDefinition":{},"implementation":{},"references":{},"documentHighlight":{},"documentSymbol":{"hierarchicalDocumentSymbolSupport":true},"codeAction":{"codeActionLiter
alSupport":{"codeActionKind":{"valueSet":["source.organizeImports"]}}},"formatting":{},"rangeFormatting":{},"onTypeFormatting":{},"codeLens":{},"documentLink":{},"rename":{},"publishDiagnostics":{},"colorProvider":{},"foldingRange":{},"selectionRange":{
}}},"initializationOptions":{"hoverKind":"FullDocumentation","staticcheck":true},"workspaceFolders":[{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm"},{"uri":"file:///Users/ilanpillemer/Repos
/bxbdigital/bx-mm/bx-pipe","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm/bx-pipe"},{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler","name":"/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler"},{"uri":"file:
///Users/ilanpillemer/Repos/bxbdigital/bxrepl/cmd/bxrepl","name":"/Users/ilanpillemer/Repos/bxbdigital/bxrepl/cmd/bxrepl"}]}

@gopherbot
Copy link

Change https://golang.org/cl/205500 mentions this issue: internal/lsp: debugging CL for golang/go#35339

@stamblerre
Copy link
Contributor

stamblerre commented Nov 5, 2019

@ilanpillemer: Just uploaded CL 205500 for you to try again. To install it, cd into your ~/go/src/golang.org/x/tools directory, sync to master, and then select "Download Patch" from the "..." menu in the top right corner. Copy the "Cherry Pick" command and then execute it in the tools directory. Rebuild gopls (cd gopls && go install && cd ..), and then you should be running with the CL.

@ilanpillemer
Copy link
Author

ilanpillemer commented Nov 5, 2019

will do first thing tomorrow morning (though if sync to latest do I lose static check?) or is static check etc included in the CL patch?

@stamblerre
Copy link
Contributor

Thanks! And no, staticcheck is in at master - you just need to opt-in with the configuration.

@ilanpillemer
Copy link
Author

I feel I am misunderstanding something.. so I sync the tools directory to latest, but I build gopls from master and then add the patch?

@stamblerre
Copy link
Contributor

Oh I'm sorry, I should've been more precise with my language. I didn't mean latest as in the latest tag, but rather latest as in master. Edited my comment.

@ilanpillemer
Copy link
Author

thanks! first thing tomorrow when I get back into the code I am working on I will do that.

@ilanpillemer
Copy link
Author

ilanpillemer commented Nov 6, 2019

I have applied the patch..

Here are some logs that may help understand what is happening?

[Trace - 10:27:19.277 AM] Sending request 'textDocument/definition - (8)'.
Params: {"textDocument":{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go"},"position":{"line":136,"character":12}}


[Trace - 10:27:19.287 AM] Received response 'textDocument/definition - (8)' in 9ms.
Result: [{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go","range":{"start":{"line":674,"character":16},"end":{"line":674,"character":32}}}]


2019/11/06 10:27:19 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:SA4006
[Trace - 10:27:19.357 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/06 10:27:19 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = SA4006"}


[Trace - 10:27:19.357 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/06 10:27:19 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:SA4006"}


2019/11/06 10:27:19 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016
[Trace - 10:27:19.365 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/06 10:27:19 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016"}


[Trace - 10:27:19.365 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/06 10:27:19 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = ST1016"}


2019/11/06 10:27:19 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000
[Trace - 10:27:19.365 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/06 10:27:19 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000"}


[Trace - 10:27:19.365 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/06 10:27:19 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = ST1000"}
[Trace - 10:29:38.291 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/cmd/main.go","diagnostics":[]}


2019/11/06 10:29:38 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:SA4006
[Trace - 10:29:38.363 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/06 10:29:38 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = SA4006"}


[Trace - 10:29:38.363 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/06 10:29:38 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:SA4006"}


2019/11/06 10:29:38 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016
[Trace - 10:29:38.385 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/06 10:29:38 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = ST1016"}


[Trace - 10:29:38.385 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/06 10:29:38 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016"}


2019/11/06 10:29:38 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000
[Trace - 10:29:38.385 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/06 10:29:38 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = ST1000"}


[Trace - 10:29:38.385 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/06 10:29:38 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000"}


[Trace - 10:29:38.387 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go","diagnostics":[]}

2019/11/06 10:32:34 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016
2019/11/06 10:32:34 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000

@stamblerre
Copy link
Contributor

Thank you for sharing these logs! I just uploaded another patchset to CL 205500 if you'd be willing to try again and share the logs.

@stamblerre stamblerre self-assigned this Nov 7, 2019
@ilanpillemer
Copy link
Author

Of course. Will do soon.

@ilanpillemer
Copy link
Author

ilanpillemer commented Nov 7, 2019

please find log attached.. hope it helps!
gopls.log

I didn't use stringer during the time of log generation.. let me know if you need another log after I do.. or if this tells you enough. I made some changes to the y file during these logs.

@ilanpillemer
Copy link
Author

ilanpillemer commented Nov 7, 2019

just in case.. I created a dummy new value.. reran go generate (which also used stringer) and here are the logs. I also restarted gopls between log generation. So previous log when a change was made in goyacc, and this one stringer. eg

//go:generate stringer -type=fieldType,bxState
//go:generate goyacc -o bx.go -p bx bx.y

gopls.log

@stamblerre
Copy link
Contributor

Thank you! Looks like one staticcheck pass is failing in some unexpected way. Just uploaded another patchset to CL 205500 if you'd be willing to try again.

@ilanpillemer
Copy link
Author

ilanpillemer commented Nov 7, 2019

I am very happy and willing to help as long as it takes.

@stamblerre
Copy link
Contributor

Great thank you so much! Pushed one more update so the quantity of log messages will be less overwhelming.

@ilanpillemer
Copy link
Author

ok. here is the log from before the last push (doesn't have the update to reduce quantity of log messages)..

gopls.log

the stderror was full of this too

[Trace - 16:21:29.189 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:21:29 running pass for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:atomicalign"}


work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
[Trace - 16:21:29.189 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:21:29 inside of the defer for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:atomicalign"}


work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
work queue is full
[Trace - 16:21:29.189 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:21:29 running pass for time:ctrlflow"}

@ilanpillemer
Copy link
Author

ilanpillemer commented Nov 7, 2019

Here are the logs after the latest patchset

gopls.log

Here are some extracts from stderror

[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 running analyses for internal/poll:inspect"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 running analyses for path/filepath:inspect"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 running analyses for math/rand:inspect"}


[Trace - 16:40:21.413 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 running analyses for internal/oserror:inspect"}


[Trace - 16:40:21.414 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.414 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:40:21.414 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:40:21 dep results: map[], err: \u003cnil\u003e"}
[Trace - 16:42:48.264 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 running analyses for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1003"}


[Trace - 16:42:48.264 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:42:48.264 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 running analyses for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1011"}


[Trace - 16:42:48.265 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 dep results: map[tokenfileanalyzer@bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:0xc01340d4a0 config@bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:0xc01376eaf0 isgenerated@bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:0xc010b22730], err: \u003cnil\u003e"}


[Trace - 16:42:48.265 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 running analyses for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1013"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 dep results: map[buildssa@bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:0xc010bdc000], err: \u003cnil\u003e"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 running analyses for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016"}


2019/11/07 16:42:48 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016
[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = ST1016"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/07 16:42:48 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1016"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 running analyses for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1018"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 dep results: map[inspect@bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:0xc00eaabc20], err: \u003cnil\u003e"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 dep results: map[], err: \u003cnil\u003e"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 nil analyses\n\tpackage = bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler\n\tanalysis = ST1000"}


2019/11/07 16:42:48 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000
[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 running analyses for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000"}


[Trace - 16:42:48.266 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/07 16:42:48 no results: unexpected nil analysis for bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:ST1000"}


[Trace - 16:42:48.267 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/07 16:42:48 dep results: map[buildssa@bitbucket.org/bxbdigital/bx-mm/internal/bxcompiler:0xc010bdc000], err: \u003cnil\u003e"}

@stamblerre
Copy link
Contributor

Wow I can't believe it took me this long to catch it! The nil pointer was coming from line 344 in internal/lsp/cache/analysis.go. Uploaded a new patchset if you'd like to take another look at it, but I think I will send out the fix for this ASAP.

@gopherbot
Copy link

Change https://golang.org/cl/205859 mentions this issue: internal/lsp/cache: handle a nil pointer exception in analysis

@ilanpillemer
Copy link
Author

I won't be ablt to check until tomorrow morning.

@ilanpillemer
Copy link
Author

logs after latest fix attached
gopls.log

gopherbot pushed a commit to golang/tools that referenced this issue Nov 8, 2019
Updates golang/go#35339

Change-Id: I2611b1a61bcf777fe4ce0f5446d1897c5698af86
Reviewed-on: https://go-review.googlesource.com/c/tools/+/205859
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
@gopherbot
Copy link

Change https://golang.org/cl/206149 mentions this issue: internal/lsp/cache: handle a nil pointer exception in analysis

@stamblerre
Copy link
Contributor

stamblerre commented Nov 8, 2019

Thanks! Just pushed another update to the CL :) The change that actually fixes the nil pointer has been merged and cherry-picked for the release, so thank you for helping me find that! The remaining investigation will help us understand why there is an error creating an error message here.

gopherbot pushed a commit to golang/tools that referenced this issue Nov 8, 2019
Updates golang/go#35339

Change-Id: I2611b1a61bcf777fe4ce0f5446d1897c5698af86
Reviewed-on: https://go-review.googlesource.com/c/tools/+/205859
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
(cherry picked from commit b93886d)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/206149
Reviewed-by: Heschi Kreinick <heschi@google.com>
@ilanpillemer
Copy link
Author

On Monday I will apply the latest CL and send the logs.

@ilanpillemer
Copy link
Author

some more logs
gopls.log

and some extracts from stderr

[Trace - 11:04:57.019 AM] Sending notification 'textDocument/didSave'.
Params: {"textDocument":{"version":0,"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go"}}


[Trace - 11:04:57.019 AM] Sending request 'textDocument/codeAction - (13)'.
Params: {"textDocument":{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go"},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"context":{"diagnostics":null,"only":["source.organizeImports"]}}


[Trace - 11:04:57.043 AM] Received response 'textDocument/codeAction - (13)' in 23ms.
Result: {}


[Trace - 11:04:57.043 AM] Sending request 'textDocument/formatting - (14)'.
Params: {"textDocument":{"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go"},"options":{"tabSize":0,"insertSpaces":false,"key":null}}


[Trace - 11:04:57.049 AM] Received response 'textDocument/formatting - (14)' in 6ms.
Result: []


2019/11/11 11:04:57 no results: ToUTF16Column: column is invalid (-1)
[Trace - 11:04:57.111 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/11 11:04:57 fixes for /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/yaccpar:332:/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/yaccpar:332 is [], \u003cnil\u003e"}


[Trace - 11:04:57.111 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/11 11:04:57 related information for /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/yaccpar:332:/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/yaccpar:332 is [], \u003cnil\u003e"}


[Trace - 11:04:57.111 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/11 11:04:57 rng: 0:0-0:0, err: ToUTF16Column: column is invalid (-1)"}


[Trace - 11:04:57.111 AM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/11 11:04:57 spn for /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/yaccpar:332:/Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/yaccpar:332 is /Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/bx.go:332-, \u003cnil\u003e"}


[Trace - 11:04:57.111 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/11 11:04:57 no results: ToUTF16Column: column is invalid (-1)"}


2019/11/11 11:04:57 no results: ToUTF16Column: column is invalid (-1)
[Trace - 11:04:57.121 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/11 11:04:57 no results: ToUTF16Column: column is invalid (-1)"}


2019/11/11 11:04:57 no results: ToUTF16Column: column is invalid (-1)
[Trace - 11:04:57.121 AM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2019/11/11 11:04:57 no results: ToUTF16Column: column is invalid (-1)"}


[Trace - 11:04:57.123 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/lexer.go","diagnostics":[]}


[Trace - 11:04:57.123 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/parser.go","diagnostics":[]}


[Trace - 11:04:57.123 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/symbols.go","diagnostics":[]}


[Trace - 11:04:57.123 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/bx.go","diagnostics":[]}


[Trace - 11:04:57.123 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/compilerflags.go","diagnostics":[]}


[Trace - 11:04:57.123 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/fieldtype_string.go","diagnostics":[]}


[Trace - 11:04:57.123 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {"uri":"file:///Users/ilanpillemer/Repos/bxbdigital/bx-mm/internal/bxcompiler/interpreter.go","diagnostics":[]}


acme-lsp$ 

@ilanpillemer
Copy link
Author

might be related to
#33690

@ilanpillemer
Copy link
Author

some more logs
gopls.log

@stamblerre
Copy link
Contributor

This error now appears to be related to #34433 and the use of yacc with gopls. I will close this issue as a duplicate of that one.

@golang golang locked and limited conversation to collaborators Dec 3, 2020
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.
Projects
None yet
Development

No branches or pull requests

3 participants