Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(transport): handle out-of-order frame on remote init stream #2358

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

mxinden
Copy link
Collaborator

@mxinden mxinden commented Jan 14, 2025

#2269 made a "stream control or data frame for a stream that is ours to initiate but we haven't yet" illegal.

pub fn obtain_stream(
&mut self,
stream_id: StreamId,
) -> Res<(Option<&mut SendStream>, Option<&mut RecvStream>)> {
self.ensure_created_if_remote(stream_id)?;
// Has this local stream existed in the past, i.e., is its index lower than the number of
// used streams?
let existed = !stream_id.is_remote_initiated(self.role)
&& self.local_stream_limits[stream_id.stream_type()].used() > stream_id.index();
let ss = self.send.get_mut(stream_id).ok();
let rs = self.recv.get_mut(stream_id).ok();
if ss.is_none() && rs.is_none() && !existed {
return Err(Error::StreamStateError);
}
Ok((ss, rs))
}

Given a remote initiated stream that has been closed and forgotten since. Say that the local node receives an out-of-order frame on said forgotten stream. In such scenario:

  • stream_id.is_remote_initiated is true
  • thus existed is false
  • ss.is_none() and rs.is_none() is true
  • ss.is_none() && rs.is_none() && !existed is true
  • thus obtain_stream falsely returns Err(Error::StreamStateError);

This commit fixes the above issue, only returning Err(Error::StreamStateError); on locally initiated streams.

Copy link

github-actions bot commented Jan 14, 2025

Failed Interop Tests

QUIC Interop Runner, client vs. server, differences relative to 7f8136e.

neqo-latest as client

neqo-latest as server

All results

Succeeded Interop Tests

QUIC Interop Runner, client vs. server

neqo-latest as client

neqo-latest as server

Unsupported Interop Tests

QUIC Interop Runner, client vs. server

neqo-latest as client

neqo-latest as server

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.29%. Comparing base (7f8136e) to head (0ae8068).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2358      +/-   ##
==========================================
- Coverage   95.29%   95.29%   -0.01%     
==========================================
  Files         114      114              
  Lines       36850    36856       +6     
  Branches    36850    36856       +6     
==========================================
+ Hits        35117    35122       +5     
- Misses       1727     1728       +1     
  Partials        6        6              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

mozilla#2269 made a "stream control or data frame for a stream that is ours to initiate but we haven't yet" illegal.

``` rust
       let existed = !stream_id.is_remote_initiated(self.role)
            && self.local_stream_limits[stream_id.stream_type()].used() > stream_id.index();
```

Problem is, when `is_remote_initiated` is `true`, then `existed` is `false`, which leads to a false positive for remote initiated streams.
@mxinden mxinden changed the title fix(transport): don't consider remote stream illegal fix(transport): support out-of-order remote initiated stream frame Jan 14, 2025
@mxinden mxinden changed the title fix(transport): support out-of-order remote initiated stream frame fix(transport): handle out-of-order frame on remote init stream Jan 14, 2025
@mxinden mxinden marked this pull request as ready for review January 14, 2025 16:17
@mxinden
Copy link
Collaborator Author

mxinden commented Jan 14, 2025

Updated PR description and added a unit test. @larseggert can you take another look?

@larseggert larseggert added this pull request to the merge queue Jan 14, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 14, 2025
@mxinden mxinden enabled auto-merge January 15, 2025 18:12
@mxinden mxinden added this pull request to the merge queue Jan 15, 2025
Merged via the queue into mozilla:main with commit 6b87603 Jan 15, 2025
65 of 69 checks passed
@mxinden mxinden deleted the local-illegal branch January 15, 2025 19:14
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.

2 participants