Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Use polling to watch certificate paths #50251
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
Use polling to watch certificate paths #50251
Changes from all commits
76bd8bb
d458978
8856efe
3e93524
098c1b5
a0596c0
421f3a2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know the performance impact of always doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How many certs do we expect an app to have? I was assuming < 10. We only poll every four seconds, so I was expecting the CPU usage to be negligible. If the certs aren't all in the same directory, then there will likely be some overhead from having multiple timer loops.
I think a lot of apps would be fine with a longer polling period, but I don't actually see a way to configure it.
If an app has 100 certs, each in a different directory and they find the overhead is too high, there's an appcontext switch to disable watching certificates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Polling isn't on by default (for the IHostingEnvironment.ContentRootFileProvider), I'm not sure it's about the number of apps, it might be the number of files being polled in the common case. Is this just polling the path specified by the cert in the 90% scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not sure I understand the question. This change should have no effect on whether or not
IHostingEnvironment.ContentRootFileProvider
uses polling. It instantiatesPhysicalFileProvider
s directly for paths to certificates and enables polling for those specifically.You've previously pointed out that that's wrong, that certificates should be watched using the host env file provider. There are two reasons I didn't do that: first, the users requesting this functionality made clear that they wanted to be able to load and watch certificates that were not under their content root; second, I didn't want to enable polling for all files in the content root because I was worried about the perf (and respecting user settings).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is that this change always turns on file watching no matter what. That’s not something we’ve tested before. I just wanted to understand the scope and impact of the polling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ReloadOnChange is true, then we will poll files in your (non-code) configuration for the default certificate and for each endpoint's certificate and SNI certificates. Obviously, this only applies to file-based certs (vs from the store). If the same certificate file appears in more than one of those locations, it will only be polled once. (There's a corner case where two different symlinks point to the same file, in which case it would be polled twice.)