-
Notifications
You must be signed in to change notification settings - Fork 22
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
Don't leak exceptions from managed threads #92
Don't leak exceptions from managed threads #92
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I made a mistake. This is deleting the thread ID twice. Shouldn't matter ,but will fix anyway.
6654f95
to
f093214
Compare
Fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. This is a nice improvement.
Merged. |
In kazu-yamamoto#92 we added an exception handler that was meant to catch _all_ exceptions (sync and async). This got changed in kazu-yamamoto#114 (specifically, kazu-yamamoto@52a9619): when we moved from `Control.Exception` to `UnliftIO.Exception`, we got a different behaviour for `catch` and friends (see well-typed/grapesy#193 (comment)) for a full list. This commit fixes some unintended consequences of this change.
In kazu-yamamoto#92 we added an exception handler that was meant to catch _all_ exceptions (sync and async). This got changed in kazu-yamamoto#114 (specifically, kazu-yamamoto@52a9619): when we moved from `Control.Exception` to `UnliftIO.Exception`, we got a different behaviour for `catch` and friends (see well-typed/grapesy#193 (comment)) for a full list. This commit fixes some unintended consequences of this change.
In kazu-yamamoto#92 we added an exception handler that was meant to catch _all_ exceptions (sync and async). This got changed in kazu-yamamoto#114 (specifically, kazu-yamamoto@52a9619): when we moved from `Control.Exception` to `UnliftIO.Exception`, we got a different behaviour for `catch` and friends (see well-typed/grapesy#193 (comment)) for a full list. This commit fixes some unintended consequences of this change.
In kazu-yamamoto#92 we added an exception handler that was meant to catch _all_ exceptions (sync and async). This got changed in kazu-yamamoto#114 (specifically, kazu-yamamoto@52a9619): when we moved from `Control.Exception` to `UnliftIO.Exception`, we got a different behaviour for `catch` and friends (see well-typed/grapesy#193 (comment)) for a full list. This commit fixes some unintended consequences of this change.
This PR makes a subtle but useful change to
forkManaged[Unmask]
: instead of usingonException
(which is whatbracket
does), we usecatch
:onException
will rethrow the exception, but this is not very useful: the only exception handler that sits above the thread is the one installed by default byforkIOWithUnmask
, which just prints the exception to the terminal. As a result, when the thread manager shuts down managed threads, sometimes thoseKilledByHttp2ThreadManager
exceptions were printed to the terminal, interfering with the regular output of the program. (Specifically, I was observing this with the thread spawned byforkAndEnqueueWhenReady
inArch/Sender.hs
.)