Marcin Rataj efe74cdbf1 return stream frames to pool on stream cancellations (#5327)
* fix: return stream frames to pool on error paths

fixes potential memory leak where StreamFrames were not returned to
sync.Pool in error/cancellation paths.

root cause: frames are llocated via GetStreamFrame() but never returned
via PutBack() when streams enter terminal states without going through
normal OnAcked() cleanup.

fixed paths:
- CancelWrite(): return frames when reliableOffset == 0
- handleStopSendingFrame(): return frames on STOP_SENDING
- closeForShutdown(): return frames on connection shutdown
- OnLost(): return frame when stream reset with no data sent

* fix: clear slice before nil assignment, remove excessive tests

- add clear() call to properly release GC references per https://github.com/quic-go/quic-go/pull/5327#discussion_r2328451862
- remove excessive pool return tests per https://github.com/quic-go/quic-go/pull/5327#discussion_r2328453227
2025-09-09 13:15:45 +02:00
2016-05-03 10:27:59 +02:00
2016-12-14 11:54:01 +01:00
2023-03-27 17:24:28 -07:00

A QUIC implementation in pure Go

Documentation PkgGoDev Code Coverage Fuzzing Status

quic-go is an implementation of the QUIC protocol (RFC 9000, RFC 9001, RFC 9002) in Go. It has support for HTTP/3 (RFC 9114), including QPACK (RFC 9204) and HTTP Datagrams (RFC 9297).

In addition to these base RFCs, it also implements the following RFCs:

Support for WebTransport over HTTP/3 (draft-ietf-webtrans-http3) is implemented in webtransport-go.

Detailed documentation can be found on quic-go.net.

Projects using quic-go

Project Description Stars
AdGuardHome Free and open source, powerful network-wide ads & trackers blocking DNS server. GitHub Repo stars
algernon Small self-contained pure-Go web server with Lua, Markdown, HTTP/2, QUIC, Redis and PostgreSQL support GitHub Repo stars
caddy Fast, multi-platform web server with automatic HTTPS GitHub Repo stars
cloudflared A tunneling daemon that proxies traffic from the Cloudflare network to your origins GitHub Repo stars
frp A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet GitHub Repo stars
go-libp2p libp2p implementation in Go, powering Kubo (IPFS) and Lotus (Filecoin), among others GitHub Repo stars
gost A simple security tunnel written in Go GitHub Repo stars
Hysteria A powerful, lightning fast and censorship resistant proxy GitHub Repo stars
Mercure An open, easy, fast, reliable and battery-efficient solution for real-time communications GitHub Repo stars
OONI Probe Next generation OONI Probe. Library and CLI tool. GitHub Repo stars
reverst Reverse Tunnels in Go over HTTP/3 and QUIC GitHub Repo stars
RoadRunner High-performance PHP application server, process manager written in Go and powered with plugins GitHub Repo stars
syncthing Open Source Continuous File Synchronization GitHub Repo stars
traefik The Cloud Native Application Proxy GitHub Repo stars
v2ray-core A platform for building proxies to bypass network restrictions GitHub Repo stars
YoMo Streaming Serverless Framework for Geo-distributed System GitHub Repo stars

If you'd like to see your project added to this list, please send us a PR.

Release Policy

quic-go always aims to support the latest two Go releases.

Contributing

We are always happy to welcome new contributors! We have a number of self-contained issues that are suitable for first-time contributors, they are tagged with help wanted. If you have any questions, please feel free to reach out by opening an issue or leaving a comment.

Description
No description provided
Readme MIT 46 MiB
Languages
Go 99.8%
Shell 0.1%