hyperium / hyperium/h2

Tolerate send_open() at Closed state?

Open
#803 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
382
Avg merge
20h 23m
Merged PRs (30d)
9

Description

I am having some issue with tunneling TCP using h2, it aborts the connection after the server (usually speedtest servers) resets the connection and h2 trying to send_open().

Not sure if this should be tolerated by h2 or to be handled by my code. I tried to do an early return with a Closed state and it seems to fix my problem.

    pub fn send_open(&mut self, eos: bool) -> Result<(), UserError> {
        let local = Streaming;

        if matches!(self.inner, Inner::Closed(_)) {
            return Ok(());
        }

https://github.com/hyperium/h2/blob/77be6648e5c6da22f51e5049347496335a032288/src/proto/streams/state.rs#L91-L129

Any suggestions on a proper workaround?

Contributor guide

Open the contributing guide

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.

Research direction

Start in src/proto/streams/state.rs around send_open(), especially the Closed-state handling, and trace how a reset leads to this call. Determine whether send_open() should tolerate Closed or whether callers must handle it; done means an agreed behavior with the corresponding regression coverage or workaround documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.