private-octopus / picoquic

Minimal implementation of the QUIC protocol
MIT License
527 stars 156 forks source link

Fix the perceived memory leak of nodes structures #1520

Closed huitema closed 1 year ago

huitema commented 1 year ago

The stream context was not properly cleared after receiving a "reset stream" frame. This was demonstrated by adding a test of allocated node memory in the "stop sending" test, and then fixing the issue.

This should address issue #1499.

huitema commented 1 year ago

Still working on this, because there is a secondary issue. The "node leak" issue can be best reproduced if there is a big packet loss rate. However, with the specific loss rate programmed for the repro, there is a high chance of experiencing spurious retransmissions. This leads somehow to cycles of repeating the "reset stream" packets, probably because of the very specific loss pattern programmed in the test.

The root cause of this repetition is that the only memory of the stream state is the stream context. The cycle could be stopped if the stream context recorded whether the "reset stream" was acked by the peer or not. It currently does not, because the stream context is closed pretty much as soon as the reset is sent. Instead we should: