Skip to content

fix(platform-wallet-ffi): release the HandleStorage registry guard before block_on in parking exports #4610

Description

@llbartekll

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions