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

Crash the process on unexpected failures when creating a JoinableTask #846

Merged
merged 1 commit into from May 5, 2021

Conversation

AArnott
Copy link
Member

@AArnott AArnott commented May 5, 2021

Strictly speaking this is not necessary, as an exception would be thrown to the caller and no lingering adverse effects to the state of JoinableTaskContext are left behind. But we find this change useful because this is scheduling code and should be very reliable. Recently an OutOfMemoryException was thrown from this code (in a process with plenty of memory) and led other code to hang because it didn't expect JTF itself to fail. See #843 for more info on that.

Validation

I tested this crashes the process with the faulting callstack intact (i.e. not unwound) by manually adding a throw new OutOfMemoryException(); near where we allocate a WeakReference<T>.
Automated tests aren't effective here because the if exercised, the new code would crash the test runner. And anyway forcing the error condition is impossible given no extensibility point exists for this area.

Strictly speaking this is not necessary, as an exception would be thrown to the caller and no lingering adverse effects to the state of `JoinableTaskContext` are left behind. But we find this change useful because this is scheduling code and should be very reliable. Recently an `OutOfMemoryException` was thrown from this code (in a process with plenty of memory) and led other code to hang because it didn't expect JTF itself to fail. See microsoft#843 for more info on that.
@AArnott AArnott added this to the v17.0 milestone May 5, 2021
@AArnott AArnott self-assigned this May 5, 2021
Copy link
Member

@jdrobison jdrobison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@AArnott AArnott merged commit 63476ca into microsoft:main May 5, 2021
@AArnott AArnott deleted the crashOnJtfFailure branch May 5, 2021 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants