Summary
HandleStorage::with_item (rs-platform-wallet-ffi/src/handle.rs ~66-72) holds the registry's parking_lot::RwLock read guard for the whole closure, and several exports block_on inside that closure: platform_wallet_manager_sync_progress, ..spv_connected_peers, ..spv_tip_unix_seconds (spv.rs ~146/298/373) and platform_wallet_pending_contact_crypto_count (dashpay.rs ~993-996, waits on wallet_manager.read()).
Consequences: platform_wallet_manager_destroy / platform_wallet_destroy (remove = registry write) wait behind any parked call, and parking_lot's writer preference then blocks every new registry reader (every FFI call on that registry) until the parked call returns — measured on iOS as teardown queued behind a 2-minute pending_contact_crypto_count.
Proposal
Clone the Arc out of the registry under the guard and run block_on / block_on_worker after the guard is released, for every export that can park.
Related
Summary
HandleStorage::with_item(rs-platform-wallet-ffi/src/handle.rs~66-72) holds the registry'sparking_lot::RwLockread guard for the whole closure, and several exportsblock_oninside that closure:platform_wallet_manager_sync_progress,..spv_connected_peers,..spv_tip_unix_seconds(spv.rs~146/298/373) andplatform_wallet_pending_contact_crypto_count(dashpay.rs~993-996, waits onwallet_manager.read()).Consequences:
platform_wallet_manager_destroy/platform_wallet_destroy(remove= registry write) wait behind any parked call, and parking_lot's writer preference then blocks every new registry reader (every FFI call on that registry) until the parked call returns — measured on iOS as teardown queued behind a 2-minutepending_contact_crypto_count.Proposal
Clone the
Arcout of the registry under the guard and runblock_on/block_on_workerafter the guard is released, for every export that can park.Related