Skip to content

http3: close qlogger after all streams have been handled#5524

Merged
marten-seemann merged 1 commit into
masterfrom
http3-close-qlogger
Jan 7, 2026
Merged

http3: close qlogger after all streams have been handled#5524
marten-seemann merged 1 commit into
masterfrom
http3-close-qlogger

Conversation

@marten-seemann

Copy link
Copy Markdown
Member

Still misses tests.

@marten-seemann marten-seemann linked an issue Jan 5, 2026 that may be closed by this pull request
@macroscopeapp

macroscopeapp Bot commented Jan 5, 2026

Copy link
Copy Markdown

Close HTTP/3 qlogger only after all stream-handling goroutines finish and tie closure to QUIC connection context in http3/conn.go

Add a WaitGroup to rawConn to track qlog-producing goroutines, register a context cancel hook to call rawConn.closeQlogger, and update stream/control handling to increment/decrement the group; add tests validating recorder lifecycles in integrationtests/self/http_qlog_test.go and integrationtests/self/qlog_test.go.

📍Where to Start

Start with newRawConn and rawConn.closeQlogger in http3/conn.go.


Macroscope summarized 3ee11c6.

@codecov

codecov Bot commented Jan 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.21%. Comparing base (29cb6ff) to head (3ee11c6).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
http3/conn.go 89.47% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@marten-seemann marten-seemann marked this pull request as ready for review January 7, 2026 07:24
@marten-seemann marten-seemann requested a review from Copilot January 7, 2026 07:24
@marten-seemann marten-seemann merged commit c5f15f2 into master Jan 7, 2026
61 of 62 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot AI Jan 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http3: need to close qlogger

2 participants