Skip to content

fix(order-stream): make WebSocket cleanup generation-aware - #2067

Open
grandpig wants to merge 1 commit into
boundless-xyz:mainfrom
grandpig:main
Open

fix(order-stream): make WebSocket cleanup generation-aware#2067
grandpig wants to merge 1 commit into
boundless-xyz:mainfrom
grandpig:main

Conversation

@grandpig

@grandpig grandpig commented Aug 3, 2026

Copy link
Copy Markdown

What

Make WebSocket connection cleanup identity-aware.

Fixes #2066

Why

Connection cleanup currently removes entries by address only. When a client reconnects with the same address, cleanup from the previous connection can remove the replacement connection. Broadcast cleanup has the same race.

Changes

  • Add a unique connection ID/generation.
  • Remove connections only when the stored ID matches the cleaning task.
  • Make broadcast cleanup generation-aware.
  • Ensure the replaced WebSocket task is explicitly terminated.
  • Add deterministic regression tests.

Testing

  • cargo test -p order-stream

Signed-off-by: grandpig <grandpig@outlook.com>
@grandpig

Copy link
Copy Markdown
Author

@capossele Just following up on this in case it got buried. This fixes the reconnect cleanup race so a stale WebSocket task can't remove its replacement connection, including the same race in broadcast cleanup. Deterministic regression tests are included. Thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[order-stream] Stale WebSocket cleanup can remove a replacement connection

1 participant