Navigation Menu

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: automated issue report (crash) - many different random crash patterns #50433

Closed
Airren opened this issue Dec 21, 2021 · 7 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.

Comments

@Airren
Copy link

Airren commented Dec 21, 2021

gopls version: v0.7.4
gopls flags:
update flags: proxy
extension version: 0.30.0
go version: 1.17.5
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Tue, 21 Dec 2021 01:44:03 GMT
restart history:
Tue, 21 Dec 2021 01:43:32 GMT: activation (enabled: true)

ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.

Describe what you observed.

Please attach the stack trace from the crash.
A window with the error message should have popped up in the lower half of your screen.
Please copy the stack trace and error messages from that window and paste it in this issue.

Failed to auto-collect gopls trace: no gopls log.

OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.

NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.

<OPTIONAL: ATTACH LOGS HERE>

@hyangah
Copy link
Contributor

hyangah commented Dec 21, 2021

Thanks for the report. Can you please share the log you see in the gopls output channel and tell us when you observed this popup (e.g. I was updating gopls, I just opened the vscode, I did refactoring, ...)?
Screen Shot 2021-01-27 at 2 53 49 PM

@Airren
Copy link
Author

Airren commented Dec 24, 2021

This is the all log.txt

I did nothing, but only read the code and jump to the function definition or something else, the error popup up several times.

@hyangah
Copy link
Contributor

hyangah commented Jan 4, 2022

Happy new year, @Airren!

Did you set any any go or gopls?

User is using multi-root setup that opens folders under the GOPATH/src directory

  • ~/go/src/github.com/airren/kubernetes
  • ~/go/src/github.com/airren/learn_k8s
  • ~/go/src/k8s.io/client-go
  • ~/go/src/k8s.io/api
  • ~/go/src/k8s.io/apimachinery

Multiple different crash patterns are found in this log. It's so badly broken that I suspect memory corruption or race...

  • Crash 1: segfault during memoize
unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x412da9]

goroutine 105488 [running]:
runtime.throw({0xd39f6c, 0xafc969f6d7d})
	/usr/local/go/src/runtime/panic.go:1198 +0x71 fp=0xc0000c2640 sp=0xc0000c2610 pc=0x436e11
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:742 +0x2f6 fp=0xc0000c2690 sp=0xc0000c2640 pc=0x44cfd6
runtime.mapaccess2_fast64(0xc01a015e70, 0xc0029e5bc0, 0xc02fcf4540)
	/usr/local/go/src/runtime/map_fast64.go:57 +0x29 fp=0xc0000c26b0 sp=0xc0000c2690 pc=0x412da9
golang.org/x/tools/internal/memoize.(*Generation).Destroy(0xc02fcf4540, {0xd66705, 0x16})
	/home/airren/go/pkg/mod/golang.org/x/tools@v0.1.9-0.20211209172050-90a85b2969be/internal/memoize/memoize.go:88 +0x1d9 fp=0xc0000c27b8 sp=0xc0000c26b0 pc=0xad9919
golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent·dwrap·66()
	/home/airren/go/pkg/mod/golang.org/x/tools@v0.1.9-0.20211209172050-90a85b2969be/internal/lsp/cache/view.go:710 +0x2e fp=0xc0000c27e0 sp=0xc0000c27b8 pc=0xb2c04e
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc0000c27e8 sp=0xc0000c27e0 pc=0x469ba1
created by golang.org/x/tools/internal/lsp/cache.(*View).invalidateContent
	/home/airren/go/pkg/mod/golang.org/x/tools@v0.1.9-0.20211209172050-90a85b2969be/internal/lsp/cache/view.go:710 +0x295

Has many cgo-related errors, and missing dependency errors, and messages like "falling back to safe trimming due to type errors".

  • Crash 2: JSON decoding error during packages.Load and segfault during memoize
[Error - 1:54:19 PM] 2021/12/24 13:54:19 initial workspace load failed: JSON decoding failed: invalid character '\x04' in string literal: packages.Load error

[Error - 1:54:19 PM] 2021/12/24 13:54:19 workspace packages: diagnosing file:///home/airren/go/src/github.com/airren/kubernetes/go.mod: JSON decoding failed: invalid character '\x04' in string literal: packages.Load error

unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x44957a]

goroutine 2670 [running]:
runtime.throw({0xd39f6c, 0x6ecac8380b7e02a8})
	/usr/local/go/src/runtime/panic.go:1198 +0x71 fp=0xc009a15290 sp=0xc009a15260 pc=0x436e11
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:742 +0x2f6 fp=0xc009a152e0 sp=0xc009a15290 pc=0x44cfd6
runtime: unexpected return pc for runtime.selectgo called from 0x7ee9dee37964dd75
stack: frame={sp:0xc009a152e0, fp:0xc009a15428} stack=[0xc009a0e000,0xc009a16000)
0x000000c009a151e0:  0x0000000000000002  0x0000000000e91d50 
0x000000c009a151f0:  0x0000000000000001  0x0000000000000001 
0x000000c009a15200:  0x000000c009a1527d  0x0000000000000003 
0x000000c009a15210:  0x000000c009a15260  0x00000000004679ce <runtime.systemstack+0x000000000000002e> 
0x000000c009a15220:  0x0000000000437050 <runtime.fatalthrow+0x0000000000000050>  0x000000c009a15230 
0x000000c009a15230:  0x0000000000437080 <runtime.fatalthrow.func1+0x0000000000000000>  0x000000c0077f7ba0 
0x000000c009a15240:  0x0000000000436e11 <runtime.throw+0x0000000000000071>  0x000000c009a15260 
0x000000c009a15250:  0x000000c009a15280  0x0000000000436e11 <runtime.throw+0x0000000000000071> 
0x000000c009a15260:  0x000000c009a15268  0x0000000000436e40 <runtime.throw.func1+0x0000000000000000> 
0x000000c009a15270:  0x0000000000d39f6c  0x0000000000000005 
0x000000c009a15280:  0x000000c009a152d0  0x000000000044cfd6 <runtime.sigpanic+0x00000000000002f6> 
0x000000c009a15290:  0x0000000000d39f6c  0x6ecac8380b7e02a8 
0x000000c009a152a0:  0xd2f831657fb9109d  0x5e2ef4b3a2d7018b 
0x000000c009a152b0:  0x0000000000000000  0x0ccaed67c43b1330 
0x000000c009a152c0:  0x000000c000057610  0x000000c000056800 
0x000000c009a152d0:  0x000000c009a15418  0x000000000044957a <runtime.selectgo+0x000000000000077a> 
0x000000c009a152e0: <0x000000c009a154b8  0x0000000000000002 
0x000000c009a152f0:  0x0000000000462e11 <sync/atomic.CompareAndSwapPointer+0x0000000000000051>  0x000000c009a15464 
0x000000c009a15300:  0x6c5be7db84d127cf  0x7bcbe362994754bc 
0x000000c009a15310:  0xf5ac181ae57119fc  0x69be583bfdda268e 
0x000000c009a15320:  0xbafcb21f9ab600f7  0xb6acd1cbd11f9929 
0x000000c009a15330:  0x5c9151c2bf183284  0x9bcedc55c4ac8db0 
0x000000c009a15340:  0x00000000004946a6 <context.(*cancelCtx).Done·dwrap·1+0x0000000000000026>  0x000000c005e63d68 
0x000000c009a15350:  0x000000c009a153d0  0x0000000000494619 <context.(*cancelCtx).Done+0x0000000000000199> 
0x000000c009a15360:  0x0000000000000000  0x0000000000000000 
0x000000c009a15370:  0x0000000000000001  0x0000000000000002 
0x000000c009a15380:  0xbdd4b0c2b0bcd837  0x95650272b9039755 
0x000000c009a15390:  0x3a034c2687a0f3fa  0x8bf6d7e44dadde01 
0x000000c009a153a0:  0x8978eaf1cd7224fc  0x34a25635cca87a72 
0x000000c009a153b0:  0xe31c4887442a53a6  0xc84b00907358ea69 
0x000000c009a153c0:  0x000000c003568960  0x000000c009a153b8 
0x000000c009a153d0:  0x000000c0077f7c28  0x000000c0077f7ce8 
0x000000c009a153e0:  0x000000c00713bb00  0x000000c009a15400 
0x000000c009a153f0:  0x0000000000495caf <context.(*valueCtx).Done+0x000000000000002f>  0x000000c004705bf0 
0x000000c009a15400:  0xab03a8dbf9d26d4f  0x850a4fe6ef0272f1 
0x000000c009a15410:  0xee84bb52ad73e62a  0x382b9e4477df2a4f 
0x000000c009a15420: !0x7ee9dee37964dd75 >0xe06a37d4040fd21a 
0x000000c009a15430:  0x652f7f096b90ad18  0x510d24d8fe7db56f 
0x000000c009a15440:  0x0000000000000000  0x000000000040e934 <runtime.mallocgc+0x00000000000006b4> 
0x000000c009a15450:  0x0000000000000001  0x0000000000000040 
0x000000c009a15460:  0x0000000100010000  0x000000c0077fe310 
0x000000c009a15470:  0x000000c003568900  0x0000000000000000 
0x000000c009a15480:  0xa8c354b9ac22f4f5  0x154276d81f984fb3 
0x000000c009a15490:  0xeba93b35d47e1a32  0x9eefc844ee31f2f8 
0x000000c009a154a0:  0xe1998efc506a3b2b  0x3e5934a10499ecac 
0x000000c009a154b0:  0x5579a54c61899f6b  0x2de324fade832463 
0x000000c009a154c0:  0x0000000000000000  0x000000c003568900 
0x000000c009a154d0:  0x0000000000000000  0x0000000000000000 
0x000000c009a154e0:  0x0000000000000000  0x000000c009a15550 
0x000000c009a154f0:  0x0000000000adb265 <golang.org/x/tools/internal/memoize.(*Handle).run+0x00000000000001c5>  0x000000c0077fe300 
0x000000c009a15500:  0x43d46fef33cc0371  0x4b62ad61380dc1f3 
0x000000c009a15510:  0x7613d6422d67f1cf  0xd7922930e3ca9dc7 
0x000000c009a15520:  0xdb30ab13ce627dd3 
runtime.selectgo(0xe06a37d4040fd21a, 0x652f7f096b90ad18, 0x510d24d8fe7db56f, 0x0, 0x40e934, 0x1)
	/usr/local/go/src/runtime/select.go:328 +0x77a fp=0xc009a15428 sp=0xc009a152e0 pc=0x44957a
created by golang.org/x/tools/internal/memoize.(*Handle).run
	/home/airren/go/pkg/mod/golang.org/x/tools@v0.1.9-0.20211209172050-90a85b2969be/internal/memoize/memoize.go:320 +0x1b0
  • Crash 3: incomprehensible version string in the error message and then crash in src/runtime/type.go
[Error - 1:54:21 PM] 2021/12/24 13:54:21 go/packages.Load: err: exit status 1: stderr: go: github.com/gogo/protobuf@v1.3.2 requires
        github.com/kisielk/errcheck@o^Z����: missing go.sum entry; to add it:
        go mod download github.com/kisielk/errcheck
go: github.com/gogo/protobuf@v1.3.2 requires
        github.com/kisielk/errcheck@o^Z����: missing go.sum entry; to add it:
        go mod download github.com/kisielk/errcheck

        snapshot=0
        directory=/home/airren/go/src/k8s.io/client-go
        query=[builtin k8s.io/client-go/...]
        packages=0

[Error - 1:54:21 PM] 2021/12/24 13:54:21 initial workspace load failed: err: exit status 1: stderr: go: github.com/gogo/protobuf@v1.3.2 requires
        github.com/kisielk/errcheck@o^Z����: missing go.sum entry; to add it:
        go mod download github.com/kisielk/errcheck
go: github.com/gogo/protobuf@v1.3.2 requires
        github.com/kisielk/errcheck@o^Z����: missing go.sum entry; to add it:
        go mod download github.com/kisielk/errcheck
: packages.Load error

[Error - 1:54:21 PM] 2021/12/24 13:54:21 go/packages.Load: err: exit status 2: stderr: unexpected fault address 0x0
fatal error: fault
unexpected fault address 0x0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x45ab59]

goroutine 1427 [running]:
runtime.throw({0x993c61, 0x35040})
        /usr/local/go/src/runtime/panic.go:1198 +0x71 fp=0xc000537a38 sp=0xc000537a08 pc=0x4350d1
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:742 +0x2f6 fp=0xc000537a88 sp=0xc000537a38 pc=0x44a996
runtime.(*_type).string(0x719e05a941f3087)
        /usr/local/go/src/runtime/type.go:51 +0x19 fp=0xc000537aa8 sp=0xc000537a88 pc=0x45ab59
runtime.(*TypeAssertionError).Error(0xc000a133e0)
        /usr/local/go/src/runtime/error.go:39 +0x9e fp=0xc000537bb0 sp=0xc000537aa8 pc=0x4092be
runtime.preprintpanics(0xc0001a8660)
        /usr/local/go/src/runtime/panic.go:701 +0x7f fp=0xc000537c10 sp=0xc000537bb0 pc=0x43395f
panic({0x91e120, 0xc000a133e0})
        /usr/local/go/src/runtime/panic.go:1145 +0x39a fp=0xc000537cd0 sp=0xc000537c10 pc=0x434c5a
runtime.panicdottypeE(0x719e05a941f3087, 0x946cc0, 0x90a420)
        /usr/local/go/src/runtime/iface.go:261 +0x75 fp=0xc000537cf0 sp=0xc000537cd0 pc=0x40bcd5
cmd/go/internal/load.loadPackageData({0xa70280, 0xc0000aa000}, {0xc000027c91, 0x4}, {0xc00049d1c0, 0x1a}, {0xc0009b3bf0, 0x2e}, {0xc00002c034, 0x1e}, ...)
        /usr/local/go/src/cmd/go/internal/load/pkg.go:836 +0x557 fp=0xc000537f10 sp=0xc000537cf0 pc=0x7eda17
cmd/go/internal/load.(*preload).preloadImports.func1({0xc000027c91, 0x19})
        /usr/local/go/src/cmd/go/internal/load/pkg.go:1024 +0xe5 fp=0xc000537fc0 sp=0xc000537f10 pc=0x7eed65
cmd/go/internal/load.(*preload).preloadImports·dwrap·4()
        /usr/local/go/src/cmd/go/internal/load/pkg.go:1029 +0x31 fp=0xc000537fe0 sp=0xc000537fc0 pc=0x7eec51
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc000537fe8 sp=0xc000537fe0 pc=0x465241
created by cmd/go/internal/load.(*preload).preloadImports
        /usr/local/go/src/cmd/go/internal/load/pkg.go:1023 +0x2c8
  • Crash 4: unbalanced scopes
[Error - 1:54:20 PM] 2021/12/24 13:54:20 go/packages.Load: err: exit status 2: stderr: warning: ignoring symlink /home/airren/go/src/github.com/airren/kubernetes/cluster/gce/cos
warning: ignoring symlink /home/airren/go/src/github.com/airren/kubernetes/cluster/gce/custom
warning: ignoring symlink /home/airren/go/src/github.com/airren/kubernetes/cluster/gce/ubuntu
warning: ignoring symlink /home/airren/go/src/github.com/airren/kubernetes/cluster/gce/cos
warning: ignoring symlink /home/airren/go/src/github.com/airren/kubernetes/cluster/gce/custom
warning: ignoring symlink /home/airren/go/src/github.com/airren/kubernetes/cluster/gce/ubuntu
panic: go/parser internal error: unbalanced scopes [recovered]
        panic: go/parser internal error: unbalanced scopes

goroutine 31260 [running]:
go/parser.ParseFile.func1()
        /usr/local/go/src/go/parser/interface.go:101 +0x18c
panic({0x8f9bc0, 0xc002c164f0})
        /usr/local/go/src/runtime/panic.go:1038 +0x215
go/parser.assert(...)
        /usr/local/go/src/go/parser/parser.go:335
go/parser.resolveFile(0xc000699500, 0xc0025cc840, 0x0)
        /usr/local/go/src/go/parser/resolver.go:35 +0x354
go/parser.(*parser).parseFile(0xc002737cc0)
        /usr/local/go/src/go/parser/parser.go:2646 +0x3fc
go/parser.ParseFile(0xc001a37180, {0xc002c1c4b0, 0x4e}, {0x8f4be0, 0xc0014f4f00}, 0x0)
        /usr/local/go/src/go/parser/interface.go:122 +0x185
go/build.readGoInfo({0xa63a60, 0xc002904670}, 0xc000e4f830)
        /usr/local/go/src/go/build/read.go:420 +0x245
go/build.(*Context).matchFile(0xd8b7e0, {0xc002d2b900, 0x45}, {0xc002d2bd06, 0x8}, 0xc002d2b914, 0xc002d1f4e0, 0xc001a37180)
        /usr/local/go/src/go/build/build.go:1434 +0x785
go/build.(*Context).Import(0xd8b7e0, {0x992bc8, 0x1}, {0xc000e10000, 0xc003326770}, 0x0)
        /usr/local/go/src/go/build/build.go:848 +0x1cf5
go/build.(*Context).ImportDir(...)
        /usr/local/go/src/go/build/build.go:485
cmd/go/internal/load.loadPackageData.func2()
        /usr/local/go/src/cmd/go/internal/load/pkg.go:851 +0x1fb
cmd/go/internal/par.(*Cache).Do(0xd8aae0, {0x8f9bc0, 0xc00244f2c0}, 0xc000f59e98)
        /usr/local/go/src/cmd/go/internal/par/work.go:128 +0xc3
cmd/go/internal/load.loadPackageData({0xa70280, 0xc0000260b0}, {0xc000330b40, 0x26}, {0x0, 0x0}, {0xc00002e004, 0x30}, {0x0, 0x0}, ...)
        /usr/local/go/src/cmd/go/internal/load/pkg.go:843 +0x465
cmd/go/internal/load.(*preload).preloadMatches.func1({0xc000330b40, 0x26})
        /usr/local/go/src/cmd/go/internal/load/pkg.go:999 +0xb1
created by cmd/go/internal/load.(*preload).preloadMatches
        /usr/local/go/src/cmd/go/internal/load/pkg.go:997 +0x255

Transferring to the gopls issue tracker.

And another problem is the crash stack dump is so large that VSCode's automated issue report that checks only the last part of the log couldn't capture the panic signature. (That will be tracked separately in vscode-go issue tracker)

@hyangah hyangah changed the title Jan 4, 2022
@hyangah hyangah transferred this issue from golang/vscode-go Jan 4, 2022
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jan 4, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jan 4, 2022
@findleyr
Copy link
Contributor

findleyr commented Jan 4, 2022

That "unbalanced scopes" error is particularly concerning for me, as it is possibly related to some parser refactoring I did for Go 1.17. But I've never seen it reported before, and I'm really surprised for it to be reported for the first time so long after go 1.17 came out.

It could be memory corruption, but I don't understand how it would manifest in this way.

@Airren is this reproducible on your end?

@findleyr findleyr modified the milestones: Unreleased, gopls/on-deck Jan 4, 2022
@findleyr
Copy link
Contributor

findleyr commented Jan 4, 2022

I stared at the "unbalanced scopes" issue in go/parser/resolver.go and don't know how it would be possible without corruption, though I of course could be missing something. Notably this appears to be happening in the go command, not directly within gopls.

@findleyr findleyr added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 11, 2022
@findleyr
Copy link
Contributor

I think without more information here we can't spend more time tracking this down. It seems to be a very broken machine (though in surprising ways). If this is reproducible we can perhaps understand it.

@suzmue
Copy link
Contributor

suzmue commented Jan 14, 2022

Closing. Please reopen if you are able to reproduce.

@suzmue suzmue closed this as completed Jan 14, 2022
@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2022
@golang golang locked and limited conversation to collaborators Aug 14, 2023
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

5 participants