You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1] Release site-replication state locks before IAM healing work #341
The IAM heal helpers hold SiteReplicationSys.RLock while invoking code that acquires the same RWMutex again. A writer arriving between the two reads blocks the new reader, while the first reader prevents that writer from completing. The resulting wait does not end with an RPC response.
Reproduced on local main e51bff35a using service-account healing and an intervening state writer. The affected helpers are healPolicies, healUserPolicies, healGroupPolicies, healUsers and healGroups. Their lock structure is inherited from 3a64580663; da8d8a54b adds the service-account path and retains the outer-lock hazard.
Use a short state read/snapshot and release the lock before CheckKey, IAMChangeHook or remote work. The supplied srStatusInfo already carries the peer information these loops use; an enabledPeers abstraction is not required if a simple enabled snapshot is sufficient. Audit any remaining helpers for the same lock-order contract.
Acceptance:
Use channels/barriers to place a waiting writer between reads, rather than a timing-only success assertion.
Both the heal operation and state writer finish within a bound.
Cover all five helpers, service accounts/ordinary users and concurrent disable or topology update; run the relevant tests with -race.
Priority: P1, release gate for site-replication deployments; not an unconditional deadlock whenever replication is enabled. Estimate: 0.5–1 day.
This remains open after the Object Lock, tagging, migration and IAM snapshot repair batch. The snapshot fixes in #345 do not resolve the healing helpers' lock lifetime.
The scoped repair should read the necessary replication state under a short read lock, then release it before IAM lookups, hooks or remote work. Existing srStatusInfo data should be reused where sufficient. This removes the nested-read/waiting-writer cycle and avoids holding replication state locked across potentially slow operations.
The trade-off is working from a state snapshot while topology or enablement can change. The implementation must preserve the existing operation-level validity checks and test those transitions explicitly.
Closure still requires deterministic barrier-based tests for all five helpers, including service accounts and ordinary users, with a waiting writer and concurrent disable/topology changes. Both the heal operation and writer must finish, and the relevant race tests must pass. This batch supplies no new acceptance evidence for that contract.
Accepted in local main at bae0ba0b7, through 745fbf043, 2f228284f and ef6efd312. This supersedes the earlier comment that left the healing gate open.
The original waiting-writer deadlock was real, and fixing the five IAM helpers alone was insufficient: status collection and bucket/metadata hooks could still hold the same read lock across reentrant work. The completed repair copies topology under a short lock, then performs IAM/storage reads, callbacks and peer RPCs after releasing it. Peer maps are cloned rather than shared; status dispatch, result indexing and error reporting use one snapshot. Concurrent peer-error collection is synchronized.
The trade-off is a small allocation per snapshot and an operation that may finish using the topology it observed at entry. Existing enablement checks and reconciliation remain in place. This does not add transactional topology changes, distributed fencing or instantaneous cancellation of in-flight RPCs.
Validation covers all five IAM helpers, both ordinary-user and service-account healing, configuration disable/reload, replacement peers, cached peer-state isolation, and blocked storage/RPC paths. Deterministic barriers verify that a real configuration writer and the healing operation both finish; the relevant suites pass with the race detector. Local acceptance on this exact source passed with Go 1.27.4: the focused -race suite, all 53 tested Go packages, make verifiers, make build, and the consistency_strict compile check. Strict runtime scenarios were not run; the optional typos check was skipped because its tool is not installed.
Closing the scoped runtime defect. The commits are merged locally; remote publication and release qualification are separate.
Activity
Vonng commentedon Nov 11, 2026
This remains open after the Object Lock, tagging, migration and IAM snapshot repair batch. The snapshot fixes in #345 do not resolve the healing helpers' lock lifetime.
The scoped repair should read the necessary replication state under a short read lock, then release it before IAM lookups, hooks or remote work. Existing srStatusInfo data should be reused where sufficient. This removes the nested-read/waiting-writer cycle and avoids holding replication state locked across potentially slow operations.
The trade-off is working from a state snapshot while topology or enablement can change. The implementation must preserve the existing operation-level validity checks and test those transitions explicitly.
Closure still requires deterministic barrier-based tests for all five helpers, including service accounts and ordinary users, with a waiting writer and concurrent disable/topology changes. Both the heal operation and writer must finish, and the relevant race tests must pass. This batch supplies no new acceptance evidence for that contract.
Vonng commentedon Nov 11, 2026
Accepted in local
mainatbae0ba0b7, through745fbf043,2f228284fandef6efd312. This supersedes the earlier comment that left the healing gate open.The original waiting-writer deadlock was real, and fixing the five IAM helpers alone was insufficient: status collection and bucket/metadata hooks could still hold the same read lock across reentrant work. The completed repair copies topology under a short lock, then performs IAM/storage reads, callbacks and peer RPCs after releasing it. Peer maps are cloned rather than shared; status dispatch, result indexing and error reporting use one snapshot. Concurrent peer-error collection is synchronized.
The trade-off is a small allocation per snapshot and an operation that may finish using the topology it observed at entry. Existing enablement checks and reconciliation remain in place. This does not add transactional topology changes, distributed fencing or instantaneous cancellation of in-flight RPCs.
Validation covers all five IAM helpers, both ordinary-user and service-account healing, configuration disable/reload, replacement peers, cached peer-state isolation, and blocked storage/RPC paths. Deterministic barriers verify that a real configuration writer and the healing operation both finish; the relevant suites pass with the race detector. Local acceptance on this exact source passed with Go 1.27.4: the focused
-racesuite, all 53 tested Go packages,make verifiers,make build, and theconsistency_strictcompile check. Strict runtime scenarios were not run; the optional typos check was skipped because its tool is not installed.Closing the scoped runtime defect. The commits are merged locally; remote publication and release qualification are separate.
fix(replication): collect site status without holding topology locks