Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy threadpool initialization #3044

Closed
rzikm opened this issue Sep 6, 2022 · 2 comments
Closed

Lazy threadpool initialization #3044

rzikm opened this issue Sep 6, 2022 · 2 comments
Assignees
Labels
Milestone

Comments

@rzikm
Copy link
Member

rzikm commented Sep 6, 2022

Describe the feature you'd like supported

In .NET Runtime, there is some logic conditioned on QUIC support on the platform (related to HTTP3). When checking QUIC support, we load the MsQuic library into the process and check the version (and query the TLS backend type), if compatible, we set some global flag.

However, calling MsQuicOpenVersion causes some threads to be created, which increases overall resources used by .NET programs even if they end up not using QUIC at all.

Proposed solution

Initialize the threadpool(s) lazily once the first Connection or Listener is created.

Additional context

We have resorted to a temporary workaround of calling MsQuicClose and later lazily reopening the library when necessary.

@nibanks
Copy link
Member

nibanks commented Sep 6, 2022

#3034 is already doing this, but you need to make sure not to create registrations if you don't want threads to get created. That is the "lazy" signal that you're about to do work and need threads.

@nibanks nibanks added this to the Future milestone Sep 6, 2022
@nibanks nibanks self-assigned this Sep 6, 2022
@nibanks
Copy link
Member

nibanks commented Oct 13, 2022

@rzikm this is fixed with recent PRs, but it is delayed to registration creation. Not connection/listener. Please update .NET to consume it and validate that querying MsQuic support no longer creates threads.

@nibanks nibanks closed this as completed Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants