Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1040 +/- ##
==========================================
- Coverage 91.79% 91.70% -0.10%
==========================================
Files 45 45
Lines 5450 5458 +8
==========================================
+ Hits 5003 5005 +2
- Misses 447 453 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Serialize all accesses to Agent.pendingBindingRequests with a dedicated mutex. The slice is mutated from sendBindingRequest, handleInboundBindingResponse, updateConnectionState (on failure) and revokeConsent. invalidatePendingBindingRequests is intentionally left unlocked because it is only called while the mutex is held.
MiniNova
force-pushed
the
fix/pending-binding-requests-race
branch
from
October 14, 2026 09:50
1043f40 to
7c706d8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Serialize all accesses to
Agent.pendingBindingRequestswith a dedicatedsync.Mutex.Root cause
pendingBindingRequests(the LRU of outbound Binding-request transaction IDs)is mutated from several places:
sendBindingRequest—invalidatePendingBindingRequests+appendhandleInboundBindingResponse—invalidatePendingBindingRequests+ removalupdateConnectionState(onFailed) — reset tomake([]bindingRequest, 0)revokeConsent—slices.DeleteFuncThese read-modify-write the slice header and its backing array. Under
go test -race, a suite that creates/tears down many short-lived agentsintermittently reports a data race on this field:
Fix
Add
pendingBindingRequestsMu sync.Mutexand hold it across every mutation.invalidatePendingBindingRequestsis intentionally left unlocked: it is onlycalled from
sendBindingRequestandhandleInboundBindingResponse, both ofwhich already hold the mutex (locking inside it would deadlock).
How tested
go build ./...andgo vet ./...clean.-race, the failing scenario(
TestCallAliceBob) reproduced the race before the change and passed15/15 runs after it.
Notes
No API or behaviour change; only synchronization around an internal cache.