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
swift-sdk: stopShieldedSync() blocks the main actor for up to 10 s #5201
PlatformWalletManager is @MainActor, and stopShieldedSync() calls platform_wallet_manager_shielded_sync_stop synchronously. That FFI block_ons ShieldedSyncManager::quiesce(), which waits up to COORDINATOR_DRAIN_BUDGET (10 s) for a shielded pass in flight; #5200 covers why a running pass cannot be interrupted. So whenever a pass is running, every caller freezes the main thread for up to 10 s.
In dashwallet-ios this froze the network-switch UI for about 10.1 s whenever a pass was in flight (MainThreadStallMonitor: ~10091, ~10144 and ~10129 ms). In a sample of one of those switches, the main thread sat in PlatformWalletManager.stopShieldedSync() → platform_wallet_manager_shielded_sync_stop → tokio park for 7724 samples. The async stopSpv() from #4994 ran on another thread during the same switch.
clearShielded() has the same shape: platform_wallet_manager_shielded_clearblock_ons clear_shielded(), which quiesces too.
shutdown() already runs the same stop off the main thread, on the per-manager shieldedStopQueue.
Direction
Add an async overload, as #4994 did for stopSpv():
admit the native operation on the main actor;
run the FFI stop on shieldedStopQueue;
back on the main actor, bump shieldedSyncGeneration and reset the progress mirrors, as the synchronous stop does now.
While the stop is in flight, refuse the shielded calls that would race it (startShieldedSync, clearShielded), as ensureNoSpvStopInFlight does for SPV. clearShielded() could get the same async treatment.
Callers that still block (dashwallet-ios)
PlatformAddressSyncCoordinator.performStop still calls the synchronous stop on these paths:
the wallet wipe (stopForWipeAsync), which deletes the wallet's rows before it stops;
the Stop action on the Sync Info screen (PlatformAddressSyncCoordinator.stop());
the re-stop in performStart when the coordinator still holds a manager.
dashpay/dashwallet-ios#1168 (open) takes the network switch off this path by leaving the stop to shutdown().
Activity
fix(syncing): let the host teardown stop shielded sync off the main t…
fix(swift-sdk): stop shielded sync off the main thread