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

Dispose ConfigurationReloadToken #1462

Closed
wants to merge 2 commits into from
Closed

Dispose ConfigurationReloadToken #1462

wants to merge 2 commits into from

Conversation

HaoK
Copy link
Member

@HaoK HaoK commented Apr 18, 2019

Merge of #588

@Tratcher
Copy link
Member

This is dangerous and unnecessary. There's no need to dispose a CTS that was already cancelled. Also, doing so would make RegisterChangeCallback throw OED instead of invoking the cancellation callback inline. We've had a lot of problems with this race elsewhere in the stack and have removed the disposal calls.

A more interesting question is do you ever dispose the ConfigurationReloadToken in the event that it won't fire?

@ajcvickers
Copy link

@HaoK So based on Chris's comments, it sounds like we shouldn't do this.

@HaoK
Copy link
Member Author

HaoK commented Apr 18, 2019

Yeah I guess the issue is that we shouldn't dispose the underlying cancellation token after it fires, but we maybe should dispose the ConfigurationReloadToken as part of ConfigurationRoot's dispose:
https://github.com/aspnet/Extensions/blob/master/src/Configuration/Config/src/ConfigurationRoot.cs#L124

Thoughts?

@Tratcher
Copy link
Member

Those roots would only be disposed at the end of the application, no? Yes that'd be a good idea, but I don't see how it ties back to the original bug report.

@HaoK
Copy link
Member Author

HaoK commented Apr 18, 2019

I'm not sure what you are referring to in the original bug, you mean "Possible CTS leak in ConfigurationReloadToken / ConfigurationRoot" ? If its not safe to dispose the CTS after firing, then the only thing we can do is dispose it when the root is disposed.

@Tratcher
Copy link
Member

They implied there was a memory accrual for non-disposed tokens during the lifetime of the app. It doesn't look that that was ever confirmed.

@HaoK
Copy link
Member Author

HaoK commented Apr 18, 2019

Configuration leaking was addressed via #861 so yeah that was reported in other issues

@HaoK
Copy link
Member Author

HaoK commented Apr 25, 2019

Closing this for now, issue remains open for tracking/discussion

@HaoK HaoK closed this Apr 25, 2019
@mmitche mmitche deleted the haok-merge-cts branch January 4, 2021 21:33
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants