Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

CancellationTokenSource is not Disposed in cache tag helpers #5649

Closed
Funbit opened this issue Jan 2, 2017 · 3 comments
Closed

CancellationTokenSource is not Disposed in cache tag helpers #5649

Funbit opened this issue Jan 2, 2017 · 3 comments
Assignees
Milestone

Comments

@Funbit
Copy link

Funbit commented Jan 2, 2017

Inside https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.TagHelpers/CacheTagHelper.cs#L80 (ProcessAsync method) there is a CancellationTokenSource instantiation without proper Dispose call.

Also, https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.TagHelpers/DistributedCacheTagHelper.cs#L72 creates a new CancellationTokenSource which is not used anywhere.

I believe these places should be fixed.

@Eilon
Copy link
Member

Eilon commented Jan 3, 2017

@Eilon
Copy link
Member

Eilon commented May 17, 2017

@sebastienros - can you take a look to see if we need to do something here? Looks like there's at least a small change we need to make?

@sebastienros
Copy link
Member

@Funbit

Based on our usage of the CancellationTokenSource there will be no Timer or callbacks registered, which means there is really nothing to dispose. There is also potentially a ManualResetEvent but I don't think it's initialized. So it should be safe in terms of memory management to not call Dispose.

My gut feeling would be to actually not call Dispose until it's proven that there is a memory leak from it, with our specific usage.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants