Skip to content

ObjectDisposedException in FileStreamCompletionSource.CompleteCallback crashes the process #28064

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

Closed
Tratcher opened this issue Dec 5, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@Tratcher
Copy link
Member

Tratcher commented Dec 5, 2018

See dotnet/aspnetcore#4422

Application: dotnet.exe
CoreCLR Version: 4.6.27110.4
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ObjectDisposedException: The CancellationTokenSource has been disposed.
   at System.Threading.CancellationTokenSource.ThrowObjectDisposedException()
   at System.IO.FileStream.FileStreamCompletionSource.CompleteCallback(UInt64 packedResult)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

In this situation the application is reading files, cancels the reads, and apparently disposing the CancellationTokenSource.

@Tratcher
Copy link
Member Author

Tratcher commented Dec 5, 2018

@stephentoub this looks like a regression introduced here:
dotnet/coreclr@5fd50d8#diff-742d93872313d38656fb88ad801f4d7bR174
_cancellationRegistration.Token can throw if the CTS was disposed.

@stephentoub
Copy link
Member

_cancellationRegistration.Token can throw if the CTS was disposed.

Ugh. That's a bug in CTR.Token; it should never throw.

@stephentoub stephentoub self-assigned this Dec 5, 2018
@stephentoub
Copy link
Member

Re-opening to track potential ports.

@karelz
Copy link
Member

karelz commented Apr 12, 2019

Part of 2.2.1 release (via PR dotnet/corefx#21417)

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 2.2.x milestone Feb 1, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants