Skip to content

platform-wallet: after a timed-out stop, start() runs a sync loop whose passes all bail #5222

Closed

Description

@llbartekll

Problem

When a coordinator's drain times out, drain_pass (packages/rs-platform-wallet/src/manager/mod.rs) latches its QuiesceGate closed (latch_closed). This is deliberate, so a wedged pass cannot be followed by a fresh one. The latch clears only when a later drain succeeds (drain_succeeded).

start() does not touch the gate. It spawns the loop thread and the loop reports running, but every pass does nothing:

  • each pass takes the is_syncing slot, sees quiescing.is_closed() and returns an empty summary;
  • a manual sync_now(true) bails the same way.

Nothing tells the host:

  • platform_wallet_manager_shielded_sync_start returns OK;
  • is_running() is true;
  • no completion event arrives, because a pass that bails returns before on_shielded_sync_completed.

The loop stays dead after the wedged pass has finished. It recovers only when another drain succeeds (a later stop, clear or unregister) or the manager is rebuilt.

How it's reached

For shielded sync through the FFI:

  1. platform_wallet_manager_shielded_sync_stop runs quiesce(). A pass outlives COORDINATOR_DRAIN_BUDGET (10 s), so the stop returns ErrorShutdownIncomplete (27) and the gate stays latched.
  2. platform_wallet_manager_shielded_sync_start on the same manager starts the loop, and all its passes bail.

In Dash Wallet iOS this happens after Sync Info → Stop while a pass runs longer than 10 s, followed by Sync Now, or after any restart on the same manager. The app then shows shielded sync as running while nothing updates. Passes longer than the drain budget are common: #5200 lists four stops that returned code 27 in eight measured teardowns.

The platform-address, identity, DPNS and DashPay coordinators use the same QuiesceGate and drain_pass. Their passes bail on the same check, and their start() does not touch the gate either. Only the shielded path was traced end to end.

Direction

Keep the latch's guarantee that no fresh pass starts while the wedged one is still running. Then either:

  • start() clears the latch once the wedged pass has drained (is_syncing is false), and otherwise keeps the gate closed and reports it; or
  • start() returns an error while the gate is latched, so the host does not report a running loop.

Related

🤖 Generated with Claude Code

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