-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Tasks and exceptions #12485
Comments
In the second case, "handled" tasks do not print their backtraces. However, it can still be accessed if you have a reference to the task object.
|
In the first case, backtrace of
The
|
Probably indirectly related - #1784 I have also seen a segfault triggered from code within a |
Also,
|
possible solution idea https://gist.github.com/vtjnash/9cd53434cc7f7e2f7a29 |
Yes, something like that should work. It can mostly be fixed in the front end by saving the exception data around the finally block. |
Also, need parens at the end of |
- save the exception to be rethrown around the code in a finally block - set bt_size=0 on task switch. since we don't remember which task the backtrace came from, it must be associated with the current task or else not exist.
improve interaction of task switches and finally blocks (#12485)
Is this similar? I found that type IgnoredException <: Exception end
type HandledException <: Exception end
try
@async begin
sleep(1.0)
try
throw(IgnoredException())
catch ex
println("Task threw and caught $ex")
!isa(ex, IgnoredException) && rethrow()
end
end
println("Throwing HandledException")
throw(HandledException())
catch ex
if isa(ex, HandledException)
println("Caught: $ex")
end
sleep(2.0)
println("Rethrowing...")
rethrow(ex) # throws HandledException()
# rethrow() # throws IgnoredException()
end If I don't pass |
Yes that looks like the same issue to me. |
Thanks @JeffBezanson. |
Experimental PR which fixes this: #28878 |
Working with exceptions in the presence of tasks can be a little frustrating. Two concrete issues I encountered:
This is because exception in transit is not task local.
The other problem is that stack traces are pretty bad when
wait
ing on a task:The backtrace from the task is not shown anywhere. Ideally it would be displayed somehow.
The text was updated successfully, but these errors were encountered: