From afef3791da08f52489ed54a2b0dd60361165a404 Mon Sep 17 00:00:00 2001 From: Jiahao Liang Date: Thu, 26 Sep 2024 22:45:50 +0800 Subject: [PATCH 1/2] fix: notify_recv after send_reset() in reset_on_recv_stream_err() to ensure local stream is released properly Similar to what have been done in fn send_reset(), we should notify RecvStream that is parked after send_reset(). --- src/proto/streams/streams.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/proto/streams/streams.rs b/src/proto/streams/streams.rs index 7c00cd51..db6466b6 100644 --- a/src/proto/streams/streams.rs +++ b/src/proto/streams/streams.rs @@ -1549,6 +1549,9 @@ impl Actions { // Reset the stream. self.send .send_reset(reason, initiator, buffer, stream, counts, &mut self.task); + self.recv.enqueue_reset_expiration(stream, counts); + // if a RecvStream is parked, ensure it's notified + stream.notify_recv(); Ok(()) } else { tracing::warn!( From cbe4c18fb698f13f615e6d6f1614d885e69cd611 Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 12 Nov 2024 10:28:48 -0500 Subject: [PATCH 2/2] update test to forget stream immediately --- tests/h2-tests/tests/stream_states.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/h2-tests/tests/stream_states.rs b/tests/h2-tests/tests/stream_states.rs index 05a96a0f..d511f92a 100644 --- a/tests/h2-tests/tests/stream_states.rs +++ b/tests/h2-tests/tests/stream_states.rs @@ -536,7 +536,12 @@ async fn recv_next_stream_id_updated_by_malformed_headers() { client.recv_frame(frames::go_away(1).protocol_error()).await; }; let srv = async move { - let mut srv = server::handshake(io).await.expect("handshake"); + let mut srv = server::Builder::new() + // forget the bad stream immediately + .max_concurrent_reset_streams(0) + .handshake::<_, Bytes>(io) + .await + .expect("handshake"); let res = srv.next().await.unwrap(); let err = res.unwrap_err(); assert_eq!(err.reason(), Some(h2::Reason::PROTOCOL_ERROR));