Skip to content

Prevent blocked profile persistence from stopping peer connections - #128

Merged
TJKoury merged 1 commit into
mainfrom
codex/peer-persistence-hotfix
Sep 7, 2026
Merged

Prevent blocked profile persistence from stopping peer connections#128
TJKoury merged 1 commit into
mainfrom
codex/peer-persistence-hotfix

Conversation

@TJKoury

@TJKoury TJKoury commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Learning a peer could block all new peer connections: AddPeer held the registry mutex while saving to FlatSQL, and InterceptUpgraded needed that mutex to record the connection. The CelesTrak live goroutine dump reproduced this chain behind background record hydration.

All registry mutations now release the memory lock before persistence. Admin writes and background statistics share a separate persistence mutex and snapshot the latest state only after acquiring it, preventing older snapshots from overwriting newer updates. Failed writes still return ErrNotPersisted.

Validation: the regression using two real libp2p hosts fails before this change and passes after it while persistence is deliberately blocked. The peers suite and focused race check pass; the regression also passes in Linux/amd64 Docker.

@TJKoury
TJKoury merged commit 9baeb78 into main Sep 7, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant