Skip to content

Defer active path activation - #6273

Open
Guillaume Hetier (guhetier) wants to merge 9 commits into
guhetier/reafactor_network_path_2from
guhetier/defer_active_path_copilot
Open

Defer active path activation#6273
Guillaume Hetier (guhetier) wants to merge 9 commits into
guhetier/reafactor_network_path_2from
guhetier/defer_active_path_copilot

Conversation

@guhetier

@guhetier Guillaume Hetier (guhetier) commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Defers active-path changes until receive processing no longer holds pointers into the path array.

Receiving a valid packet containing non-probing frames on a path makes this path active.
However, setting a path as active moves it to the front of the path array, which can potentially invalidate pointers to paths.

To avoid this:

  • track which path needs to be active
  • only make it active once all packets in the receive operation are processed

The active path is mostly needed to send (it is by definition the path the connection uses to send packets), so it isn't a problem to defer the operation until the end of the receive loop. A side benefit is that it avoids multiple updates in sequence if multiple migrations would be triggered in a single receive operation.

Testing

CI and local testing

Documentation

No documentation impact.

Record active-path changes during receive processing and apply them after path pointers are no longer in use. Refactor active-path selection and migration handling around the pending path ID.

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

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
Resolve the path inside QuicPathSetActive so callers do not pass pointers that the activation operation may invalidate.

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

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
Comment thread src/core/connection.c
Connection,
"Non-active path has no replacement for retired CID.");
//
// A path pending deferred activation is still considered non-active here and

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Note to reviewer: Known gap, addressed in the next PR in the PR stack when this QuicPathRemove is also deferred to after processing the received packets.

@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.57%. Comparing base (7e5c632) to head (64e50bd).

Files with missing lines Patch % Lines
src/core/connection.c 92.30% 1 Missing ⚠️
src/core/path.c 95.00% 1 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##           guhetier/reafactor_network_path_2    #6273      +/-   ##
=====================================================================
+ Coverage                              85.34%   85.57%   +0.22%     
=====================================================================
  Files                                     60       60              
  Lines                                  19008    19033      +25     
=====================================================================
+ Hits                                   16222    16287      +65     
+ Misses                                  2786     2746      -40     

☔ View full report in Codecov by Harness.
📢 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.

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

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
@guhetier
Guillaume Hetier (guhetier) marked this pull request as ready for review September 3, 2026 22:08
@guhetier
Guillaume Hetier (guhetier) requested a review from a team as a code owner September 3, 2026 22:08
Use 32-bit path IDs throughout packet metadata and route resolution, and reject new path creation before NextPathId would wrap.

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

Copilot-Session: 03ce1c1f-9bb3-4a56-be65-d7f4d3fb46eb
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.

1 participant