cloudflare / cloudflare/quiche

Residual stream

Open
#1,968 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
11.8k
Forks
1.1k
Avg merge
21h 9m
Merged PRs (30d)
6

Description

In some case while just using the provided `Connection` method it is possible to have residual stream that are never collected/cleaned within a quiche Connection.

Here is how to trigger it with a code sample
```rust
let mut pipe = testing::Pipe::with_server_config(&mut config).unwrap();

pipe.handshake().unwrap();

let mut buf = [0u8;32];

// Open a stream and send some data
assert_eq!(pipe.client.stream_send(2, b"hello world", false), Ok(11));
pipe.advance().unwrap();

// Send a reset_stream frame
pipe.client.stream_shutdown(2, Shutdown::Write, 0).unwrap();
pipe.advance().unwrap();

// check that the stream are correctly handled
assert_eq!(pipe.client.streams.len(), 0);
assert_eq!(pipe.server.streams.len(), 1);

// Shutdown on the server side
pipe.server.stream_shutdown(2, Shutdown::Read, 0).unwrap();

// Now to be coherent we should have no more stream in the server side but this assertion is true
eprintln!("this assertion should failed");
assert_eq!(pipe.server.streams.len(), 1); // we expect the length to be 0 here

// But in fact the stream is not collected and quiche behave as follows
assert_eq!(pipe.server.stream_readable_next(), None);
assert_eq!(pipe.server.stream_recv(2, &mut buf), Err(Error::Done));
assert_eq!(pipe.server.streams.len(), 1);

// It is now impossible to collect/cleanup the stream
```

I can make a pull request to fix this if you are interested
Best regards.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.