Skip to content

Sync: let a queued command give up at its own deadline without breaking command order #1009

Backlog

Description

@DeepDiver1975

RemoteIncidentSession.SendAsync sends one command at a time, in order: each call waits for the previous command's queue marker (await previous) before it POSTs. That wait does not observe the caller's CancellationToken.

Since #996, AddScbaTruppAsync (Atemschutz: Bereitstellen on a joined device) is awaited under a SyncProtocol.CommandTimeout deadline. The token reaches PostAsync, but not the queue wait in front of it. If an earlier command is still in flight, for example an AddFileAsync metadata command sent with the default token, the registration cannot end at its own deadline. It waits until the predecessor finishes, and the BEREITSTELLEN button stays disabled meanwhile.

The wait is bounded today: fire-and-forget predecessors stop at CommandTimeout (15 s), and awaited ones at HttpClient's timeout (100 s by default). So this is a responsiveness issue, not a hang. It was raised on review of #996 and left out of that PR on purpose, because the queue is shared by every command.

What a fix has to keep: make the queue wait cancellation-aware (previous.WaitAsync(ct)) without breaking ordering. A caller that gives up while queued must not complete its own marker before its predecessor does. Otherwise a later command can overtake a command still on the wire and be refused as an unknown id, which is the reason the queue exists. A shape that keeps this: on cancellation, chain the marker's completion onto previous instead of completing it in the finally.

Test: stall a predecessor against a scripted host, cancel a queued command, and assert that it returns at its deadline and that a command queued after it still reaches the host after the stalled one.

Activity

  1. added
    enhancement
    on Nov 24, 2026
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions