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: panicked when a reset stream would decrement twice #685

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/proto/streams/recv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,15 +859,6 @@ impl Recv {

tracing::trace!("enqueue_reset_expiration; {:?}", stream.id);

if !counts.can_inc_num_reset_streams() {
// try to evict 1 stream if possible
// if max allow is 0, this won't be able to evict,
// and then we'll just bail after
if let Some(evicted) = self.pending_reset_expired.pop(stream.store_mut()) {
counts.transition_after(evicted, true);
}
}

if counts.can_inc_num_reset_streams() {
counts.inc_num_reset_streams();
self.pending_reset_expired.push(stream);
Expand Down
12 changes: 6 additions & 6 deletions tests/h2-tests/tests/stream_states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,14 +750,14 @@ async fn rst_stream_max() {
srv.recv_frame(frames::reset(1).cancel()).await;
srv.recv_frame(frames::reset(3).cancel()).await;
// sending frame after canceled!
// newer streams trump older streams
// 3 is still being ignored
srv.send_frame(frames::data(3, vec![0; 16]).eos()).await;
// olders streams trump newer streams
// 1 is still being ignored
srv.send_frame(frames::data(1, vec![0; 16]).eos()).await;
// ping pong to be sure of no goaway
srv.ping_pong([1; 8]).await;
// 1 has been evicted, will get a reset
srv.send_frame(frames::data(1, vec![0; 16]).eos()).await;
srv.recv_frame(frames::reset(1).stream_closed()).await;
// 3 has been evicted, will get a reset
srv.send_frame(frames::data(3, vec![0; 16]).eos()).await;
srv.recv_frame(frames::reset(3).stream_closed()).await;
};

let client = async move {
Expand Down