Async server reorders and drops client-stream DATA frames
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 15/100
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from containerd/ttrpc-rust
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
containerd/ttrpc-rust#338 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
containerd/ttrpc-rust#317 · 1 comment ·
-
Add single connection support to ServerPossibly taken @KarstenB claimed this 204 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
containerd/ttrpc-rust#293 ·
-
Can the asynchronous client connect operation support asynchronous mode to avoid connect blocking?Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
containerd/ttrpc-rust#265 · 1 comment ·
-
Please update `protobuf` to the latest v3.5.1 version for both ttrpc-codegen and ttrpc-compilerOpen
Difficulty 3/5 1-2 days Newbie friendliness 42/100
containerd/ttrpc-rust#237 ·
All issues in containerd/ttrpc-rust
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
longbridge/nsh#4201 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
moq-dev/moq#10463 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day