http3: close qlogger after all streams have been handled#5524
Conversation
Close HTTP/3 qlogger only after all stream-handling goroutines finish and tie closure to QUIC connection context in http3/conn.goAdd a 📍Where to StartStart with Macroscope summarized 3ee11c6. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5524 +/- ##
==========================================
+ Coverage 84.11% 84.21% +0.09%
==========================================
Files 159 159
Lines 16350 16366 +16
==========================================
+ Hits 13752 13781 +29
+ Misses 1963 1953 -10
+ Partials 635 632 -3 ☔ View full report in Codecov by Sentry. |
c999c84 to
3ee11c6
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements proper lifecycle management for qloggers in HTTP/3 connections by ensuring that qloggers are closed only after all streams and goroutines that may produce qlog events have completed.
Key Changes:
- Added a WaitGroup to track active goroutines and streams that may produce qlog events
- Implemented automatic qlogger cleanup when the connection context completes
- Added integration tests to verify qlogger cleanup in both QUIC-only and HTTP/3 scenarios
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| integrationtests/self/qlog_test.go | New test file verifying qlogger closure for QUIC connections during normal handshake and failed handshake scenarios |
| integrationtests/self/http_qlog_test.go | New test file verifying qlogger closure for HTTP/3 connections with schema checking |
| http3/conn.go | Core implementation adding WaitGroup tracking for control streams, request streams, unidirectional streams, and datagram goroutines, plus closeQlogger method triggered by connection context completion |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| type mockTrace struct { | ||
| openRecorders atomic.Int32 | ||
|
|
||
| SchemasChecked []string |
There was a problem hiding this comment.
The SchemasChecked slice is accessed without synchronization. The SupportsSchemas method appends to this slice from the QUIC connection's goroutine, while the test reads from it in the test goroutine. This creates a potential data race. Consider protecting access to this slice with a mutex.
Still misses tests.