Commit Graph

6920 Commits

Author SHA1 Message Date
Marten Seemann
e6d5d960e3 qlog: implement a minimal jsontext-like JSON encoder (#5353)
* qlog: use fork of encoding/json/jsontext instead of unmaintained gojay

* implement a minimal jsontext-compatible encoder

* qlogtext: improve fuzz test

* qlog: simplify JSON encoding error handling

* qlog: make use of jsontext.Bool
2025-10-06 06:48:40 +02:00
Marten Seemann
7c1ce0efe2 ackhandler: track lost packets and detect spurious losses (#5355)
* ackhandler: implement a lost packet tracker

* logging: add ConnectionTracer.DetectedSpuriousLoss event

* ackhandler: detect spurious losses

* qlog: add support for logging spurious packet loss

* ackhandler: delete lost packets after detecting spurios loss

* guard against slice index underflow
v0.55.0
2025-10-03 09:59:50 +02:00
Marten Seemann
0f5d99db94 fix missing tracing of restored transport parameters (#5349) 2025-10-03 08:53:20 +02:00
Marten Seemann
f607ef489f protocol: optimize ConnectionID.String (#5351)
This function is used by qlog, so it should be fast.
2025-10-03 14:27:39 +08:00
Marten Seemann
ce7c9ea883 drop initial keys when the handshake is confirmed (#5354) 2025-10-03 07:25:05 +02:00
Marten Seemann
97f3aae776 use synctest to make the connection tests fully deterministic (#5317) 2025-09-24 12:54:22 +02:00
Marten Seemann
2ac3b16df4 improve connection timer logic (#5339)
* simplify timer resets

As of Go 1.23, timer resets work as expected, and there’s no need to
read a (potentially) stale value from the timer channel.

* don't save the last time

* track if blocked

* remove unblock after sendingScheduled

* fix unblock logic when sending

* don't use fallthrough

* track the blocking mode

* remove stale comment
2025-09-24 10:43:01 +02:00
Marten Seemann
44869e6823 add a benchmark test for data transfers (#5335) 2025-09-20 12:23:50 +02:00
Marten Seemann
adc13be540 implement a memory-optimized time.Time replacement (#5334)
* implement a memory-optimized time.Time replacement

* monotime: properly handle systems with bad timer resolution (Windows)

* monotime: simplify Since
2025-09-14 08:12:10 +02:00
Marten Seemann
f61188b8ff ackhandler: add a benchmark for sending and acknowledging packets (#5333)
* ackhandler: add a benchmark for sending and acknowledging packets

* report allocs, improve benchmark names
2025-09-14 07:00:13 +02:00
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
dependabot[bot]
075f701ccb ci: bump actions/setup-go from 5 to 6 (#5330)
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5 to 6.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-09-08 06:52:38 +02:00
Glonee
0ae8c03816 http3: don't allow usage of closed Transport (#5324)
* do not allow use a closed transport

* update tests

* add test

* Update http3/transport.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* unit tests

* update test

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-09-07 12:52:25 +02:00
Marten Seemann
6dcac15a12 qlog: merge event category and name (#5329)
This follows a (not so recent) change to the qlog specification.
2025-09-07 11:40:45 +02:00
Marten Seemann
2dfd4dd6bf qlog: add a benchmark for the ConnectionTracer (#5328)
This test aims to benchmark a somewhat realistic scenario of a QUIC
connection that sends packets and receives acknowledgments.
2025-09-07 11:16:26 +02:00
Glonee
483d257336 http3: fix race in concurrent Transport.RoundTrip calls (#5323)
* http3: fix data race in Transport

* reset init Once
2025-09-07 05:25:00 +02:00
Marten Seemann
357f679072 ackhandler: store the last four skipped packets (#5322)
This allows for more accurate packet number difference calculations,
which is especially important once we attempt to detect spurious loss
detection events.
2025-08-30 08:05:59 +02:00
Marten Seemann
0bef51ec76 ackhandler: account for skipped packets in packet threshold calculation (#5316) 2025-08-29 05:39:41 +02:00
Marten Seemann
9cd98f48bf ackhandler: store skipped packet numbers separately (#5314) 2025-08-29 05:09:46 +02:00
Marten Seemann
5bb2146b47 ackhandler: avoid storing packet number in packet struct (#5312)
* ackhandler: optimize memory layout of packet struct

The packet number can be derived from the position that this packet is
stored at in the packets slice in the sent packet history. There is no
need to store the packet number, saving 8 bytes per packet.

* ackhandler: avoid copying the packet struct
2025-08-29 04:18:45 +02:00
Marten Seemann
13a9a650f2 ci: fix cache paths in cross compile workflow (#5318) 2025-08-29 04:05:44 +02:00
Marten Seemann
b6119744e4 ci: improve cache key generation for the cross compilation job (#5315) 2025-08-28 17:12:06 +02:00
Marten Seemann
c8e7cd66e3 ackhandler: immediately clear ackedPacket slice after processing ACK (#5313)
* ackhandler: immediately clear ackedPacket slice after processing ACK

* ackhandler: add defensive check for empty ackedPackets slice
2025-08-28 16:12:20 +02:00
Marten Seemann
168889f283 ackhandler: use a typed mock for the ECNHandler (#5311)
No functional change expected.
2025-08-28 13:39:42 +02:00
Marten Seemann
0cd4bd940b ackhandler: use an iterator to process received packet ranges (#5309)
* ackhandler: use an interator to track received packet ranges

* use slices.Collect

* naming convention
2025-08-28 10:32:26 +02:00
Marten Seemann
cead8cfbd6 ackhandler: fix resetting of packet.isPathProbePacket (#5310) 2025-08-28 10:18:49 +02:00
Marten Seemann
7f98a8b7ca utils: use synctest to make the timer tests fully deterministic (#5306)
* utils: use synctest to make the timer tests fully deterministic

* Go 1.24 workaround
2025-08-25 09:25:50 +02:00
Marten Seemann
d0d8bc2674 use synctest to make the datagram queue tests fully deterministic (#5305) 2025-08-25 06:38:40 +02:00
Marten Seemann
08b4d3c708 use synctest to make the outgoing path manager tests fully deterministic (#5304) 2025-08-24 23:32:43 +08:00
Marten Seemann
b126b42c8b ci: use go mod tidy -diff to check for tidied go.mod (#5303) 2025-08-24 12:27:56 +02:00
Marten Seemann
baf363b641 use synctest to make the send stream tests fully deterministic (#5298) 2025-08-24 07:09:16 +02:00
Marten Seemann
d424c94805 use synctest to make the send queue tests fully deterministic (#5302) 2025-08-24 06:58:41 +02:00
Marten Seemann
98b84a3523 use synctest.Wait in receive stream tests (#5299) 2025-08-24 12:35:55 +08:00
Marten Seemann
92e7eca419 restore previously deleted TestStreamsMapConcurrent test (#5301) 2025-08-24 06:18:22 +02:00
Marten Seemann
ade68c8e0f ci: fix cache save and restore logic for cross compile workflow (#5300)
lookup-only doesn't download the cache, even if it's there. This is not what we
intended: we still want to use the cache for PRs, we just want to upload a
new cache.
2025-08-24 05:48:49 +02:00
Marten Seemann
c04a550a18 ci: cache the Go build cache for cross-compilation workflow (#5297)
* ci: cache the Go build cache for cross-compilation workflow

* only store cache when on master

* don't hash go.sum in
2025-08-23 18:27:48 +02:00
Marten Seemann
258d6b1352 use synctest to make streams map tests fully deterministic (#5296)
* use synctest to make streams map tests fully deterministic

* ignore synctest helper package for code coverage
2025-08-23 18:11:59 +02:00
Marten Seemann
257281b6e2 use synctest to make receive stream tests fully deterministc (#5291) 2025-08-20 09:44:19 +02:00
dependabot[bot]
fb82d0da00 ci: bump actions/checkout from 4 to 5 (#5293)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-18 04:53:15 +02:00
Marten Seemann
8c062ae604 use testing.B.Loop in all benchmark tests (#5285)
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -category=bloop -fix -test ./...
was used as a starting point.
2025-08-16 12:44:56 +02:00
Marten Seemann
66e5c5ebaa replace interface{} with any (#5290)
No functional change expected.
2025-08-16 07:21:18 +02:00
Marten Seemann
fea19fc3ec update to Go 1.25, drop Go 1.23, use go tool for gomock (#5283)
* update to Go 1.25, drop support for Go 1.23

* ci: update golangci-lint to v2.4.0

* use new go tool command for gomock / mockgen

* also update Go version used for oss-fuzz
2025-08-16 06:14:01 +02:00
Marten Seemann
fee90a89ef ackhandler: generalize check for missing packets below threshold (#5260)
* ackhandler: check for missing packets below reordering treshold

No functional change expected.

With the Acknowledgement Frequency extension, the reordering threshold
will become configurable. With this change, it will be easy to use the
peer-requested value instead of the predefined constant.

* improve documentation

* call HighestMissingUpTo in randomized test
2025-08-14 16:51:24 +02:00
Marten Seemann
da27fcf33f expose basic connection stats via Conn.ConnectionStats (#5281)
* Add ConnectionStats

* remove for loop

* Add comments

* Update comments

---------

Co-authored-by: Marco Munizaga <git@marcopolo.io>
2025-08-13 16:45:14 +02:00
WeidiDeng
e0a836f597 fix documentation for EarlyListener.Close (#5284)
* quic: update documentaion for EarlyListener.Close

* fix missing space

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-08-13 22:26:26 +08:00
WeidiDeng
f0042715d7 http3: fix documentation for Server.ServeListener (#5282) 2025-08-12 16:14:09 +02:00
Marten Seemann
7e636553d6 fix repeated initialization of outgoingPathManager in Conn.AddPath (#5280)
In case of concurrent calls, this may still be called multiple times.

Co-authored-by: Marco Munizaga <git@marcopolo.io>
2025-08-12 22:00:08 +08:00
Benjamin M. Schwartz
c7cf12703d quicvarint: tolerate empty reads of the underlying io.Reader (#5275)
* Tolerate empty reads in `quicvarint.Read`

Currently, `quicvarint.Read` misinterprets an empty read (`n==0`)
as a single zero byte.  While empty reads are "discouraged" in
the `io.Reader` interface, they do sometimes happen, especially
when using `io.Pipe()`.

This change tolerates empty reads, adds a corresponding unit test,
and also includes some additional test coverage related to empty
capsules

* minor test refactor

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-08-05 08:05:52 +02:00
Marten Seemann
fa8ca045dd quicvarint: extend benchmark to use quicvarint.Reader (#5278)
* quicvarint: extend benchmark to use quicvarint.Reader

* rename variable
2025-08-05 07:49:55 +02:00
Marten Seemann
5422e4c68c ackhandler: remove unused time from receivedPacketHandler.ReceivedPacket (#5277)
* ackhandler: remove unused time from receivedPacketHandler.ReceivedPacket

No functional change expected.

* fix typo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* also fix typo in tests

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 06:03:02 +02:00