Avoid stack overflows in CompositeEndpointDataSource #44392
Closed
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.
Avoid stack overflows in CompositeEndpointDataSource
This stack overflow is a little different than the stack overflow originally reported by a customer in #44085 when integrating YARP.
However, it is a regression that could potentially be hit by non-YARPEndpointDataSource
implementations.I accidently hit this stack overflow when preparing an Ignite demo. And while there is a workaround to implement the custom
EndpointDataSource
more correctly by ensuring the customGetChangeToken()
implementation doesn't return the old change token while cancelling it,this did not cause a stack overflow or really any other problem in .NET 6, so this is a regression.Fixes #44085
Customer Impact
EndpointDataSource
is an advanced API, and defining a custom implementation that fires change tokens is rarer still. See https://grep.app/search?current=3&q=%3A%20EndpointDataSource for example usages.Examining grep.app shows a few custom implementations that do fire a token, but the ones I've seen so far do so correctly in a way that will not trigger a stack overflow. All of the following examples replace the token before cancelling which works around this issue. I have not found any counterexamples yet.
Regression?
And this is where I double checked and realized this isn't a regression lol. 😆 I still think this is a good change, but it's not worth servicing. I'll retarget to
main
.Risk
[Justify the selection above]
Verification
Packaging changes reviewed?