-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix treatment of async exceptions #138
Fix treatment of async exceptions #138
Conversation
I checked all uses of
I also checked onTimeout `E.catch` ignoreAll The intention here is I think to ignore exceptions thrown by the timeout handler itself, so it's indeed correct to not catch async exceptions here. Left this one unchanged also. |
After discussing with @khibino some days ago, I began to think that asynchronous exceptions are a bad pattern in Haskell network programming. |
I think the test failure we're seeing is unrelated to this PR. I can produce it on my machine on
(then timeout). It happens only very rarely, but it does happen. I'm also seeing these show up from time to time, on
|
6114db7
to
23685aa
Compare
Have rebased on latest |
Asynchronous are indeed notoriously difficult to deal with. Removing them from This feels like quite a large design departure (though a compat shim could be provided that just spawns an additional thread, waitings on the |
Threads should check STM in the beginning of each loop. import Control.Concurrent
import Control.Concurrent.STM
import System.Posix.Types
checkReadAvailable :: Socket -> IO (STM (), IO ())
checkReadAvailable s = withFdSocket s $ \fd -> threadWaitReadSTM $ Fd fd Timeout can be implemented with SystemTimerManager. |
Yes, a polling setup like you describe is possible. |
Yes. @khibino and I actually use it in |
Thanks. I will ping you! |
Yup, will do! |
23685aa
to
22d1fc1
Compare
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.
22d1fc1
to
e753c9f
Compare
@kazu-yamamoto I have rebased (and also ran |
Ok, the |
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.
LGTM
Merged. |
Thanks @kazu-yamamoto ! |
In #92 we added an exception handler that was meant to catch all exceptions (sync and async). This got changed in #114 (specifically, 52a9619): when we moved from
Control.Exception
toUnliftIO.Exception
, we got a different behaviour forcatch
and friends (see well-typed/grapesy#193 (comment)) for a full list. This commit fixes some unintended consequences of this change.I tried to do an exhaustive check of all uses of these functions in
http2
, I'll post a full report separately.