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: "negative WaitGroup counter" panic in diagnoseChangedViews #71177

Open
adonovan opened this issue Jan 8, 2025 · 3 comments
Open
Labels
gopls/telemetry-wins 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

@adonovan
Copy link
Member

adonovan commented Jan 8, 2025

#!stacks
"runtime.gopanic" && "sync.(*WaitGroup).Add:+19" && "diagnoseChangedViews.func1:+16`"

Issue created by stacks.

func (wg *WaitGroup) Add(delta int) {
...
	state := wg.state.Add(uint64(delta) << 32)
	v := int32(state >> 32)
	w := uint32(state)
...
	if v < 0 {
		panic("sync: negative WaitGroup counter") // <---------- here
	}

This stack OKWeGA was reported by telemetry:

golang.org/x/tools/[email protected] go1.23.3 linux/amd64 vscode (1)
@adonovan adonovan added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. gopls/telemetry-wins labels Jan 8, 2025
@gopherbot gopherbot added this to the Unreleased milestone Jan 8, 2025
@adonovan
Copy link
Member Author

adonovan commented Jan 8, 2025

I can't explain this. Calls to Add and Done are strictly paired and the Done always happens after the Add. There are no other salient uses of the WaitGroup.

Paging compiler and runtime folks. @prattmic

@prattmic
Copy link
Member

prattmic commented Jan 9, 2025

I agree, this use of WaitGroup looks straightforward and bug free to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/telemetry-wins 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
None yet
Development

No branches or pull requests

4 participants