Async server reorders and drops client-stream DATA frames

Open
#340 0 comments 0 reactions 0 assignees View on GitHub

@shvbsle is already working on this.

Since Nov 13, 2026.

  • #341 by @shvbsle — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
15/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
api

Research direction

Start with ServerReader::handle_msg, which spawns a task per frame, and HandlerContext::handle_msg, where wait_tx is dropped before the DATA frame is sent to stream_tx. handle_stream has the same gap for the stream-init payload. Reproduce with the 20-stream, 200-frame ordering test under a single pinned CPU; done means every frame arrives once, in order, and REMOTE_CLOSED cannot overtake the last DATA frame.

Written by the indexing model from the issue text.

Description

Description of problem

On the async server, client-to-server stream DATA frames can reach the handler out of order, and the REMOTE_CLOSED frame can overtake the last DATA frame and drop it. Also reported in https://github.com/aws/containers-roadmap/issues/2913.

ServerReader::handle_msg spawns a task per frame. For DATA frames, HandlerContext::handle_msg drops wait_tx (releasing the reader) before it pushes the frame onto the stream's channel, so consecutive frames of one stream race each other to stream_tx.send(). handle_stream has the same gap for the stream-init payload.

This is the server-side half of #311; #312 fixed only the client reader.

To reproduce: open 20 client-streaming streams on one connection, send 200 sequence-numbered frames each over 20 rounds, and check the order in the handler. The race needs a worker preempted inside that gap, so pin the process to one CPU alongside two busy threads.

Expected result

The handler receives every frame of a stream, once, in the order the client sent it.

Actual result

It fails every run on 0.10.0:

(frames out of order, frames received) of 80000 sent
  left: (3, 79939)
 right: (0, 80000)

Frames are reordered and some are lost silently, with no error on either side.

Dominant language
Rust
Stars
374
Forks
64
Avg merge
3d 5h
Merged PRs (30d)
6

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from containerd/ttrpc-rust

All issues in containerd/ttrpc-rust

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.