Skip to content

fix: make the wear send hold and spark disconnect atomic #2185

Backlog

Description

@jvsena42

Part of #2105.
Source: review, #2182

On the watch, WatchSparkService.holdSend() and disconnect() are not atomic: the held-send count is read outside the service mutex. A send that takes its hold just after disconnect checked the count runs on a disconnected SDK and ends as unknown, keeping its note, although it most likely never left.

It is safe (unknown, the note kept, no second payment) and needs a pause, lock or wipe in a window of a few milliseconds.

Proposal

  • Let holdSend coordinate with disconnect under the mutex and fail with not-ready when a disconnect has begun.

Done when

  • A unit test interleaves a hold and a disconnect and gets not-ready, with the note dropped.

Found in review round 3 of the Wear OS payments PR.

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