Skip to content

Conversation

@guhetier
Copy link
Collaborator

Description

Fixes #5346.

When creating a QTIP listener with a wildcard port:

  • a UDP socket is created first (to reserve the UDP port as XDP will take it over), and the OS would assign an ephemeral port to it
  • a TCP socket is created second (to reserve the TCP port as XDP will take it over)
    • but instead of re-using the same port, the initial config was re-used, and the OS would assign a different ephemeral port
    • this second port would override the first one in the MsQuic socket config

The main consequences of this bug are:

  • the right UDP port was not reserved when creating a listener with a wildcard port
  • if later on, the OS assigned the UDP port matching the listener TCP port, MsQuic would fail to create a binding (causing the test failure we observed)

Creating a listener without a port set is largely a test scenario.
Creating a client connection with an unspecified a port was ok because only a TCP or a UDP socket is created for client connection.

Testing

C/I. We should add some test to validate port reservation in XDP scenarios, but it will take efforts to enable test to create sockets cross-platform.

Documentation

N/A

@guhetier guhetier requested a review from a team as a code owner November 25, 2025 01:59
@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.65%. Comparing base (e71ea64) to head (7911fd3).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5626      +/-   ##
==========================================
- Coverage   84.88%   84.65%   -0.23%     
==========================================
  Files          60       60              
  Lines       18663    18663              
==========================================
- Hits        15842    15800      -42     
- Misses       2821     2863      +42     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@guhetier guhetier marked this pull request as draft November 25, 2025 03:55
@guhetier guhetier marked this pull request as ready for review November 25, 2025 22:40
@guhetier guhetier marked this pull request as draft November 25, 2025 23:45
@guhetier guhetier marked this pull request as ready for review November 26, 2025 08:22
Copy link
Contributor

@ProjectsByJackHe ProjectsByJackHe left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this!

The old code was at best redundant and at worst causing these spurious bugs.

@ProjectsByJackHe ProjectsByJackHe merged commit 3f321b6 into main Nov 26, 2025
538 of 541 checks passed
@ProjectsByJackHe ProjectsByJackHe deleted the guhetier/fix_qtip_port branch November 26, 2025 19:56
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.

[CI - FAILURE] SendQtip failed

3 participants