Open
Description
Related: #74
This is a minimal reproduction of the issue we're seeing.
describe "withException" $ do
it "should work when withAsync is in the handler" $ do
let
action =
error "oops"
`onException` do
let
timerAction n = do
threadDelay 1000000
when (n < 10) $ do
timerAction (n + 1)
withAsync (timerAction 0) $ \a -> do
cancel a
action
`shouldThrow`
errorCall "oops"
This should finish instantaneously, but it actually waits for timerAction
to complete - all 10 seconds of it. cancel
is therefore broken inside of a withException
or onException
or even a bracket
call.
What's very surprising about this behavior is that catch
doesn't share it. catch
works exactly like you'd expect, even though a very simple implementation of withException
is withException action handler = catch action (\e -> handler e >> throwIO e)
.
Metadata
Metadata
Assignees
Labels
No labels