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
platform-wallet-ffi: SPV stop holds the manager registry read guard for its whole run #5191
platform_wallet_manager_spv_stop (packages/rs-platform-wallet-ffi/src/spv.rs) runs block_on_worker(spv.stop()) inside PLATFORM_WALLET_MANAGER_STORAGE.with_item, so the global manager registry's read guard is held for the whole stop. That can take about 32 s (15 s client stop, 15 s run-loop join, 2 s abort grace), longer while a broadcast is still waiting for acceptance (see #5192).
parking_lot::RwLock blocks new readers as soon as a writer is waiting. A registry writer queued behind a long stop (insert when a manager is configured, remove on destroy) parks, and while it waits every other FFI registry read, from any thread, blocks too. With the async stopSpv() from #4994 the host's main actor stays free during the stop, so configuring another manager in the meantime moves the freeze from stopSpv to configure.
Why the guard is held today
It makes platform_wallet_manager_destroy wait for the stop. Destroy removes the handle, joins the workers and fires the host's release_fn; a cloned Arc<SpvRuntime> keeps the runtime alive but not the host contexts it calls into. spv_start and spv_clear_storage hold it for the same reason.
Direction
Keep the destroy barrier without the registry guard: for example a per-manager count of in-flight lifecycle operations that destroy waits on outside the registry lock. Then clone spv_arc() under the guard, drop the guard, and run the stop, as the read-only SPV exports already do.
Activity