Skip to content

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

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

kakkoyun
Copy link

@kakkoyun kakkoyun commented May 19, 2025

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]

…e reporting

- 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.

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

Signed-off-by: Kemal Akkoyun <[email protected]>
@kakkoyun
Copy link
Author

cc @EtiennePerot

I keep tagging you to get attention on the checklocks but please let me know if it is annoying :)

@kakkoyun kakkoyun changed the title refactor(checklocks): enhance diagnostics and deduplication in failure reporting fix(checklocks): enhance diagnostics and deduplication in failure reporting May 20, 2025
copybara-service bot pushed a commit that referenced this pull request May 21, 2025
…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
copybara-service bot pushed a commit that referenced this pull request May 21, 2025
…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
copybara-service bot pushed a commit that referenced this pull request May 21, 2025
…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
copybara-service bot pushed a commit that referenced this pull request May 21, 2025
…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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants