Skip to content

Spontaneous inbound events considered harmful #3369

@guoye-zhang

Description

@guoye-zhang

One of the most common issues when implementing a network protocol is data truncation. This is frequent encountered on the client side when a fully received response blocked by temporary back pressure gets terminated part way due to a close event or an error. The ultimate cause is that inbound events do not respect back pressure and can be processed out-of-order with reads.

A robust protocol implementation needs to intercept all inbound events and buffer them, finish reading remaining data, then decide whether to forward the inbound events up or drop them. It is hard to exhaustively test all possible event ordering, so this code is often fragile.

I'm creating the issue to start a discussion on how we can help implementors avoid this common pitfall.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementImprovements to existing feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions