Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Fix CancellationTokenRegistration.Token after CTS.Dispose #21394

Merged
merged 1 commit into from
Dec 6, 2018

Conversation

stephentoub
Copy link
Member

CTR.Token should never throw, but it's currently throwing an ObjectDisposedException if the associated CancellationTokenSource has been disposed.

Fixes https://github.com/dotnet/corefx/issues/33844
cc: @kouvel, @tarekgh

CTR.Token should never throw, but it's currently throwing an ObjectDisposedException if the associated CancellationTokenSource has been disposed.
@Tratcher
Copy link
Member

Tratcher commented Dec 6, 2018

Is this a patch candidate? It looks like it regressed in 2.1 and is causing app crashes.

@stephentoub
Copy link
Member Author

stephentoub commented Dec 6, 2018

Is this a patch candidate? It looks like it regressed in 2.1 and is causing app crashes.

I believe it should be as well, though if I'm understanding the other issue correctly, I suggest you also investigate why the CTS in ASP.NET is being disposed of while operations are still in flight.

@stephentoub
Copy link
Member Author

@dotnet-bot test OSX10.12 x64 Checked Innerloop Build and Test please
@dotnet-bot test Windows_NT x64 full_opt ryujit CoreCLR Perf Tests Correctness please
@dotnet-bot test Windows_NT x64 min_opt ryujit CoreCLR Perf Tests Correctness please
@dotnet-bot test Windows_NT x86 full_opt ryujit CoreCLR Perf Tests Correctness please
@dotnet-bot test Windows_NT x86 min_opt ryujit CoreCLR Perf Tests Correctness please

@Tratcher
Copy link
Member

Tratcher commented Dec 6, 2018

I believe it should be as well, though if I'm understanding the other issue correctly, I suggest you also investigate why the CTS in ASP.NET is being disposed of while operations are still in flight.

Yes, we have a separate fix for that. It was being disposed immediately after cancellation under the assumption that nobody had access to the CTS, only the token.

@stephentoub stephentoub merged commit 588faa5 into dotnet:master Dec 6, 2018
@stephentoub stephentoub deleted the fixctrtoken branch December 6, 2018 18:41
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…eclr#21394)

CTR.Token should never throw, but it's currently throwing an ObjectDisposedException if the associated CancellationTokenSource has been disposed.

Commit migrated from dotnet/coreclr@588faa5
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