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/internal/regtest/workspace: unrecognized failures #59080

Closed
gopherbot opened this issue Mar 16, 2023 · 7 comments
Closed

x/tools/gopls/internal/regtest/workspace: unrecognized failures #59080

gopherbot opened this issue Mar 16, 2023 · 7 comments
Assignees
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@gopherbot
Copy link

#!watchflakes
post <- pkg == "golang.org/x/tools/gopls/internal/regtest/workspace" && test == ""

Issue created automatically to collect these failures.

Example (log):

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

goroutine 3130 [running]:
golang.org/x/tools/internal/gcimporter.iexportCommon.func1()
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:93 +0xb0
panic({0x9de840?, 0x131d6f0?})
	/workdir/go/src/runtime/panic.go:913 +0x27c
go/token.(*File).Offset(0x0, 0xc0034b65d0?)
	/workdir/go/src/go/token/position.go:277 +0x34
golang.org/x/tools/internal/gcimporter.(*iexporter).fileIndexAndOffset(0xc0000f8690, 0x0, 0xc0034bc180?)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:384 +0x214
golang.org/x/tools/internal/gcimporter.(*exportWriter).posV2(0xc0034bc180, 0x689167)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:587 +0x94
golang.org/x/tools/internal/gcimporter.(*exportWriter).pos(0xc0034bc188?, 0xc0034b6546?)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:569 +0x60
golang.org/x/tools/internal/gcimporter.(*iexporter).doDecl(0xc0000f8690, {0xd93ee0, 0xc003485620})
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:465 +0x21c
golang.org/x/tools/internal/gcimporter.iexportCommon({0xd84200, 0xc0034b64b0}, 0xc0006c6980, 0x0, 0x1, 0x2, {0xc00068feb8, 0x1, 0x560d24?})
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:139 +0x364
golang.org/x/tools/internal/gcimporter.IExportShallow(0x56106c?, 0xc002fb7130)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:43 +0x80
golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).checkPackageForImport.func2()
	/workdir/gopath/src/golang.org/x/tools/gopls/internal/lsp/cache/check.go:355 +0x4c
created by golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).checkPackageForImport in goroutine 2469
	/workdir/gopath/src/golang.org/x/tools/gopls/internal/lsp/cache/check.go:354 +0x2e0

watchflakes

@gopherbot gopherbot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 16, 2023
@gopherbot
Copy link
Author

Found new dashboard test flakes for:

#!watchflakes
post <- pkg == "golang.org/x/tools/gopls/internal/regtest/workspace" && test == ""
2023-03-16 18:45 linux-ppc64le-buildlet tools@b222520f go@23e8f43c x/tools/gopls/internal/regtest/workspace (log)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x157cb4]

goroutine 3130 [running]:
golang.org/x/tools/internal/gcimporter.iexportCommon.func1()
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:93 +0xb0
panic({0x9de840?, 0x131d6f0?})
	/workdir/go/src/runtime/panic.go:913 +0x27c
go/token.(*File).Offset(0x0, 0xc0034b65d0?)
	/workdir/go/src/go/token/position.go:277 +0x34
golang.org/x/tools/internal/gcimporter.(*iexporter).fileIndexAndOffset(0xc0000f8690, 0x0, 0xc0034bc180?)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:384 +0x214
golang.org/x/tools/internal/gcimporter.(*exportWriter).posV2(0xc0034bc180, 0x689167)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:587 +0x94
golang.org/x/tools/internal/gcimporter.(*exportWriter).pos(0xc0034bc188?, 0xc0034b6546?)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:569 +0x60
golang.org/x/tools/internal/gcimporter.(*iexporter).doDecl(0xc0000f8690, {0xd93ee0, 0xc003485620})
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:465 +0x21c
golang.org/x/tools/internal/gcimporter.iexportCommon({0xd84200, 0xc0034b64b0}, 0xc0006c6980, 0x0, 0x1, 0x2, {0xc00068feb8, 0x1, 0x560d24?})
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:139 +0x364
golang.org/x/tools/internal/gcimporter.IExportShallow(0x56106c?, 0xc002fb7130)
	/workdir/gopath/src/golang.org/x/tools/internal/gcimporter/iexport.go:43 +0x80
golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).checkPackageForImport.func2()
	/workdir/gopath/src/golang.org/x/tools/gopls/internal/lsp/cache/check.go:355 +0x4c
created by golang.org/x/tools/gopls/internal/lsp/cache.(*typeCheckBatch).checkPackageForImport in goroutine 2469
	/workdir/gopath/src/golang.org/x/tools/gopls/internal/lsp/cache/check.go:354 +0x2e0

watchflakes

@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 Mar 16, 2023
@gopherbot gopherbot added this to the Unreleased milestone Mar 16, 2023
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.12.0 Mar 17, 2023
@findleyr
Copy link
Contributor

This one is concerning. Almost certainly related to the new parsing/caching logic, but I don't know how yet. CC @adonovan

@gopherbot
Copy link
Author

Change https://go.dev/cl/477275 mentions this issue: gopls/internal/lsp/cache: add additional debug assertions during parsing

@adonovan
Copy link
Member

adonovan commented Mar 17, 2023

I think I see the bug, in AddExistingFiles:

	// Reject overlapping files.
	// Discard adjacent identical files.
	out := newFiles[:0]
	for i, file := range newFiles {
		if i > 0 {
			prev := newFiles[i-1] // here
                         ...
		}
		out = append(out, file)
	}
	newFiles = out

The line marked 'here' should be comparing against out[len(out)-1], the last item to come out the filter, not the last to go in.

I've lost count of how many times I've made this mistake.

gopherbot pushed a commit to golang/tools that referenced this issue Mar 17, 2023
To narrow down the concerning issue golang/go#59080, add additional
early debug assertions to help narrow down a root cause.

For golang/go#59080

Change-Id: Ib18c2e7328eaf059c908afc6260f3212f685573c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/477275
Reviewed-by: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@findleyr
Copy link
Contributor

findleyr commented Mar 17, 2023

Hmm, I thought about that during review. Since we've already sorted by base, the only way this could matter is if we have multiple files with the same base. That would be a bug.

@adonovan adonovan self-assigned this Mar 17, 2023
@adonovan
Copy link
Member

adonovan commented Apr 7, 2023

Still waiting to see a second instance of this panic, or the first instance of failure of the new assertions added in CL https://go.dev/cl/477275.

@findleyr
Copy link
Contributor

findleyr commented May 3, 2023

No reoccurences since the first failure.

We've seen spurious NPE on ppc64 (e.g. #59910), so I think this is not worth pursuing unless we get a reoccurence.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
@golang golang locked and limited conversation to collaborators May 2, 2024
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. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
Status: Done
Development

No branches or pull requests

3 participants