Skip to content

fix(checklocks): enhance diagnostics and deduplication in failure reporting #11751

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

fix(checklocks): enhance diagnostics and deduplication in failure reporting

This change aims to improve the clarity and accuracy of failure reporting in the analysis tool, reducing noise in diagnostics.

Previous output:

-: return with unexpected locks held (locks: &({param:s}.mu) exclusively)
-: return with unexpected locks held (locks: &(*(&({*ssa.Call:0x14003d9fe80}.trace)).mu) exclusively)
-: return with unexpected locks held (locks: &(*(&({*ssa.Call:0x14003db0a00}.trace)).mu) exclusively)
-: return with unexpected locks held (locks: &(*(&({*ssa.Call:0x14003db1600}[0].trace)).mu) exclusively)

Current output:

# gvisor.dev/gvisor/tools/checklocks/test
test/basics.go:130:6: return with unexpected locks held (locks: &({param:tc}.mu) exclusively)
test/methods.go:95:6: lock a.mu (&({param:a}.mu)) not held exclusively (locks: no locks held)
  • Introduced a mechanism to track the current function during checks for improved diagnostics when SSA positions are missing.
  • Enhanced the maybeFail function to build a message string for deduplication, ensuring identical diagnostics are not reported multiple times for the same position key.
  • Updated the passContext struct to include a new reported map for tracking reported messages.

Signed-off-by: Kemal Akkoyun [email protected]
FUTURE_COPYBARA_INTEGRATE_REVIEW=#11741 from kakkoyun:existing_issues 3f8b63f

@copybara-service copybara-service bot added the exported Issue was exported automatically label May 21, 2025
@copybara-service copybara-service bot force-pushed the test/cl761287214 branch 2 times, most recently from 331bec3 to 2579cb9 Compare May 21, 2025 18:06
…orting

This change aims to improve the clarity and accuracy of failure reporting in the analysis tool, reducing noise in diagnostics.

Previous output:
```text
-: return with unexpected locks held (locks: &({param:s}.mu) exclusively)
-: return with unexpected locks held (locks: &(*(&({*ssa.Call:0x14003d9fe80}.trace)).mu) exclusively)
-: return with unexpected locks held (locks: &(*(&({*ssa.Call:0x14003db0a00}.trace)).mu) exclusively)
-: return with unexpected locks held (locks: &(*(&({*ssa.Call:0x14003db1600}[0].trace)).mu) exclusively)
```

Current output:
```text
# gvisor.dev/gvisor/tools/checklocks/test
test/basics.go:130:6: return with unexpected locks held (locks: &({param:tc}.mu) exclusively)
test/methods.go:95:6: lock a.mu (&({param:a}.mu)) not held exclusively (locks: no locks held)
````

- Introduced a mechanism to track the current function during checks for improved diagnostics when SSA positions are missing.
- Enhanced the `maybeFail` function to build a message string for deduplication, ensuring identical diagnostics are not reported multiple times for the same position key.
- Updated the `passContext` struct to include a new `reported` map for tracking reported messages.

Signed-off-by: Kemal Akkoyun <[email protected]>
FUTURE_COPYBARA_INTEGRATE_REVIEW=#11741 from kakkoyun:existing_issues 3f8b63f
PiperOrigin-RevId: 761287214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exported Issue was exported automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant