Skip to content

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented May 21, 2025

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 5759a5d

@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 5 times, most recently from 7548408 to fd1a5b9 Compare May 28, 2025 17:11
…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 5759a5d
PiperOrigin-RevId: 761287214
@copybara-service copybara-service bot closed this May 28, 2025
@copybara-service copybara-service bot deleted the test/cl761287214 branch May 28, 2025 20:05
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