SnodePool: fix use-after-free when running post-refresh callbacks - #105
Merged
mpretty-cyro merged 4 commits intoJul 30, 2026
Merged
Conversation
mpretty-cyro
force-pushed
the
fix/snode-pool-crash
branch
from
July 30, 2026 01:36
e026b63 to
6f8f38b
Compare
Fixes a segfault on the quic loop thread ~1s after launch (Session iOS 2.15.4, 3 crashes in 20 minutes of Appium runs against devnet). - Run the post-refresh callbacks from a moved-out copy of `_after_snode_cache_refresh`. A deferred `get_swarm` re-registers itself mid-loop, reallocating the vector being iterated. The old trailing `clear()` also discarded those re-registrations, so a waiting `get_swarm` could hang instead. - Make `_update_cache` synchronous via `call_get`, so its `&nodes` capture can't dangle. Both callers are already on the loop thread, so no behaviour change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mpretty-cyro
force-pushed
the
fix/snode-pool-crash
branch
from
July 30, 2026 01:38
6f8f38b to
c7c7a9a
Compare
jagerman
approved these changes
Jul 30, 2026
jagerman
approved these changes
Jul 30, 2026
mpretty-cyro
force-pushed
the
fix/snode-pool-crash
branch
from
July 30, 2026 02:06
acdbff1 to
b1ba785
Compare
mpretty-cyro
enabled auto-merge
July 30, 2026 02:23
jagerman
pushed a commit
that referenced
this pull request
Jul 30, 2026
Forward-port of #105 (dev commits c7c7a9a..56afd17) onto pfs. - Run the post-refresh callbacks from a moved-out copy of `_after_snode_cache_refresh`. A deferred `get_swarm` re-registers itself mid-loop, reallocating the vector being iterated. The old trailing `clear()` also discarded those re-registrations, so a waiting `get_swarm` could hang instead. - Make `_update_cache` synchronous via `call_get`, so its `&nodes` capture can't dangle. Both callers are already on the loop thread, so no behaviour change. Line-for-line identical to the dev change apart from adapting the test to pfs's `_hexbytes` -> `_hex_b` literal rename.
jagerman
added a commit
that referenced
this pull request
Jul 30, 2026
dev's only new content since 7e4d764 is #105 (SnodePool post-refresh callback use-after-free) plus its follow-up comment tweak, forward-ported to pfs in 984e3a2. This merge therefore uses `-s ours` to keep pfs's tree byte-for-byte unchanged; it exists only to record dev as merged so that a future `git merge pfs` into dev doesn't re-present those hunks as conflicts.
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.
Fixes a segfault on the quic loop thread ~1s after launch (Session iOS 2.15.4, 3 crashes in 20 minutes of Appium runs against devnet).
_after_snode_cache_refresh. A deferredget_swarmre-registers itself mid-loop, reallocating the vector being iterated. The old trailingclear()also discarded those re-registrations, so a waitingget_swarmcould hang instead._update_cachesynchronous viacall_get, so its&nodescapture can't dangle. Both callers are already on the loop thread, so no behaviour change.