-
Notifications
You must be signed in to change notification settings - Fork 264
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
AsyncCancelled in Warp #845
Comments
I'd replace all usage's of If you're concerned about adding a new dependency to |
No objection to add a new dependency. Let's use excellent libraries. Could you take care of this issue? |
@kazu-yamamoto, @snoyberg To be honest I haven't completely verified my assumption, but my guess is that this or a related change now exposes "Thread killed by timeout manager" exceptions if a UncaughtExceptionHandler is in place - so at least in my case a the update from lts-17.15 (warp 3.3.14) to lts-18.0 (warp 3.3.16) breaks my logic to try a graceful shutdown of the process if an uncaught async exception is occurring. Please let me know if this was a wanted or unwanted side-effect. Means, do I need to adapt and ignore these exceptions, because they are used as an interruption signal and "crashing" these threads is intended; or may I hope for a release of the library that "wraps" the threaded function in something that swallows these exceptions? I hope the problem got clear enough - please let me know if I was unclear (I'm still a haskell beginner). Just one last note, I find it very hard if a UncaughtExceptionHandler need to decide which exceptions are acceptable (e.g. here as a signal to cancel a thread) and which indicate a potential problem (because a thread just crashed unexpectedly). |
I'm sorry, I don't understand the problem you're describing. |
@snoyberg Many thanks for your answer. I was very vague yesterday, but I had some time for additional investigation on the behavioural change I spotted between warp 3.3.14 and 3.3.16. I hope I do a better job presenting the problem now: The easiest way to detect the changed behaviour - add a handler for uncaught exceptions that prints out any exception (via setUncaughtExceptionHandler) and server some content via run. Now just telnet into your server and wait for the timeout.
Result with warp 3.3.14 - No exceptions is passed to the custom uncaught exception handler. Hope this (together with my previous comment) make sense now. If things are still unclear I could try to extract a minimal code-set that directly reproduces the described change. |
I've just upgraded from
Previously, I would see just
When the browser closes the websocket, this Playing some more, I see that more browsing and closing tabs and then waiting a few minutes triggered:
I'm not really sure exactly why that is. This doesn't stop the server from functioning, however. Hunch: perhaps the |
Perhaps #839 is related to the issue I'm seeing. I'll move my discussion there. |
I moved my issue here: #850 |
@snoyberg |
I think we should move this discussion over to #850. And I'm not convinced switching to |
@alaendle it would be much easier to be sure we're talking about the same issue here if you provide a minimal repro. Perhaps you can add it to #850 like @chrisdone has? |
Agreed, no need for a repro, thanks for confirming the fix worked! |
In my QUIC implementations, a QUIC connection consists of multiple Haskell threads. To avoid leaking threads,
race
andcuncurrently
of theasync
library are used.To implement an HTTP server over QUC, Warp is launched in a QUIC runner function. In this use case, Warp MUST NOT ignore
AsyncCancelled
. If Warp ignores it, threads are leaked.Currently
SomeException
is ignored in many places of Warp. I would like to modify it so as at leastAsyncCanceled
is re-thrown. It would be easy to fix every part ofSomeException
but it is awkward.@snoyberg I think you are an expert of exception handling. Could you suggest an elegant solution? For instance, introducing a type which does not match
AsyncCancelled
instead ofSomeException
.The text was updated successfully, but these errors were encountered: