Skip to content

Conversation

@mtfriesen
Copy link
Contributor

@mtfriesen mtfriesen commented Aug 22, 2025

Description

Describe the purpose of and changes within this Pull Request.

Resolves #5372

Adds a new (preview) listener parameter QUIC_PARAM_LISTENER_PARTITION_INDEX to affinitize all event indications onto that partition and affinitizes all related object (connections, and by transitivity, streams) to that same partition. There is already a preview feature for client connections, ConnectionOpenInPartition. This is currently only supported end-to-end on linux with epoll, though much of the churn is cross-platform.

This feature is primarily useful when operating in external execution context modes: it allows fine-grained control over where MsQuic processes all activity for a listener.

I found quite a few issues with the existing (preview) external execution context mode, which I tried to fix independently in #5384, but that fix was incomplete. I eventually had to add an asynchronous RegistrationClose2 API, else it was impossible to close and unload the registration, execution context, and MsQuic.

Testing

Do any existing tests cover this change? Are new tests needed?

Added basic functional testing for the existing (preview) execution context feature, as well as targeted functional tests for partition affinity of listeners and connections. Streams are already implicitly aligned to connections and were not tested.

Documentation

Is there any documentation impact for this change?

All of these features are in preview; documentation was updated and improved.

@codecov
Copy link

codecov bot commented Aug 22, 2025

Codecov Report

❌ Patch coverage is 58.65103% with 141 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.77%. Comparing base (a17ff50) to head (fb7f991).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/core/worker.c 17.94% 64 Missing ⚠️
src/core/listener.c 41.05% 56 Missing ⚠️
src/core/library.c 80.76% 10 Missing ⚠️
src/core/connection.c 82.14% 5 Missing ⚠️
src/core/registration.c 92.59% 4 Missing ⚠️
src/core/binding.c 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5376      +/-   ##
==========================================
- Coverage   86.77%   84.77%   -2.00%     
==========================================
  Files          59       59              
  Lines       18328    18600     +272     
==========================================
- Hits        15904    15769     -135     
- Misses       2424     2831     +407     

☔ 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.

@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@microsoft microsoft deleted a comment from github-actions bot Aug 25, 2025
@mtfriesen mtfriesen force-pushed the mtfriesen/partition_affinity branch from 98bb7fe to 06b3fc7 Compare August 26, 2025 21:13
@microsoft microsoft deleted a comment from github-actions bot Sep 4, 2025
@microsoft microsoft deleted a comment from github-actions bot Sep 4, 2025
@mtfriesen mtfriesen marked this pull request as ready for review September 4, 2025 18:42
@mtfriesen mtfriesen requested a review from a team as a code owner September 4, 2025 18:42
@mtfriesen mtfriesen enabled auto-merge (squash) September 4, 2025 20:33
@mtfriesen mtfriesen merged commit ca5c05f into main Sep 4, 2025
524 of 529 checks passed
@mtfriesen mtfriesen deleted the mtfriesen/partition_affinity branch September 4, 2025 23:17
Copilot AI pushed a commit that referenced this pull request Oct 10, 2025
* WIP - listener affinity

* WIP - listener events are onto partition thread

* make connections explicitly partitioned, too

* fix winuser build

* update the sidecar, again

* try to fix thread id abstraction

* add array bounds assert

* fix winkernel build (finally?)

* update rust bindings

* fix dotnet, too

* fix more rust

* fix a few bugs

* WIP - test

* add more tests, which all fail

* sync submodules

* WIP

* add docs

* WIP - tests passing w/o partition option

* WIP - listener use-after-free on close notification

* WIP - partition test (WIP) passes

* WIP - more precise tests

* test variable numbers of ecs

* finalize basic test coverage

* fix non-linux test build

* more rust

* fix release build

* fix dotnet

* updating sidecar

* codecheck

* fix winkernel build

* try again to fix winkernel

* STILL fix winkernel

* fix winkernel yet again

* fix win official

* RE-fix

* fix one listener bug

* more listener fixes

* more rust gen

* more fixes

* properly disable the feature on iouring/linux_xdp

* ensure connections aren't implicitly partitioned

* remove flaky/fragile/wrong stateless retry test

* WIP

* more fixes

* improve comment

* fix sidecar

* initialize event for compiler

* fix unref'd param

* make connection async close wait opt-in

* rename listener refcounts for clarity

* add connection close async param

* fixes

* official build fix

* dotnet

* update spinquic for conn close async param

* address PR feedback

* do todo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add partition affinity options for all callbacks

4 participants