Skip to content

ackhandler: fix counting of packets queued for PTO probing#5539

Merged
marten-seemann merged 1 commit into
masterfrom
ackhandler-fix-pto-probe-counting
Jan 11, 2026
Merged

ackhandler: fix counting of packets queued for PTO probing#5539
marten-seemann merged 1 commit into
masterfrom
ackhandler-fix-pto-probe-counting

Conversation

@marten-seemann

Copy link
Copy Markdown
Member

When an old packet is queued for retransmission to be able to send a PTO probe packet, it needs to removed from the outstanding packet count.

When an old packet is queued for retransmission to be able to send a PTO
probe packet, it needs to removed from the outstanding packet count.
@marten-seemann marten-seemann linked an issue Jan 11, 2026 that may be closed by this pull request
@macroscopeapp

macroscopeapp Bot commented Jan 11, 2026

Copy link
Copy Markdown

Fix counting of PTO probe-queued packets by declaring loss before removing bytes-in-flight in internal/ackhandler.sentPacketHandler.QueueProbePacket

Reorder QueueProbePacket to call pnSpace.history.DeclareLost(pn) before clearing frames via queueFramesForRetransmission and removing bytes-in-flight; extend PTO test to assert timer cancellation and qlog cancel event. See sent_packet_handler.go and sent_packet_handler_test.go.

📍Where to Start

Start with sentPacketHandler.QueueProbePacket in sent_packet_handler.go.


Macroscope summarized 211fe8b.

@codecov

codecov Bot commented Jan 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.15%. Comparing base (bd4aea9) to head (211fe8b).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5539      +/-   ##
==========================================
- Coverage   84.17%   84.15%   -0.02%     
==========================================
  Files         159      159              
  Lines       16366    16366              
==========================================
- Hits        13776    13772       -4     
- Misses       1956     1959       +3     
- Partials      634      635       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 fixes a bug in the packet counting logic when queuing packets for PTO (Probe Timeout) retransmission. The issue was that when an old packet is queued for retransmission to send a PTO probe, it wasn't being properly removed from the outstanding packet count.

Changes:

  • Reordered operations in QueueProbePacket to call DeclareLost before queueFramesForRetransmission
  • Added a comment explaining why the order matters (DeclareLost must be called before queueFramesForRetransmission clears the frames)
  • Enhanced test coverage to verify that the loss detection timer is properly cancelled when all packets are acknowledged

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/ackhandler/sent_packet_handler.go Reordered method calls in QueueProbePacket to fix outstanding packet count tracking by calling DeclareLost before queueFramesForRetransmission
internal/ackhandler/sent_packet_handler_test.go Added test assertions to verify loss detection timer cancellation when all packets are acknowledged, and fixed comment capitalization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marten-seemann marten-seemann merged commit 7659dd8 into master Jan 11, 2026
55 checks passed
marten-seemann added a commit that referenced this pull request Jan 11, 2026
When an old packet is queued for retransmission to be able to send a PTO
probe packet, it needs to removed from the outstanding packet count.
wwqgtxx pushed a commit to MetaCubeX/quic-go that referenced this pull request Jan 11, 2026
 (quic-go#5539)

When an old packet is queued for retransmission to be able to send a PTO
probe packet, it needs to removed from the outstanding packet count.
wwqgtxx pushed a commit to MetaCubeX/quic-go that referenced this pull request Jan 11, 2026
 (quic-go#5539)

When an old packet is queued for retransmission to be able to send a PTO
probe packet, it needs to removed from the outstanding packet count.
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.

Large number of QUIC PING frames observed, is this normal?

2 participants