Skip to content
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

Errors in remote asynchronous tasks lose their error message when displayed on the caller on Julia 1.6 #40337

Closed
jishnub opened this issue Apr 4, 2021 · 0 comments · Fixed by #40395
Assignees
Labels
error handling Handling of exceptions by Julia or the user parallelism Parallel or distributed computation regression Regression in behavior compared to a previous version

Comments

@jishnub
Copy link
Contributor

jishnub commented Apr 4, 2021

Cross-posting from discourse as there was no response there

On Julia 1.6:

julia> @fetchfrom 2 @sync @async error("errmsg")
ERROR: On worker 2:
TaskFailedException

    nested task error: 
Stacktrace:
 [1] sync_end
   @ ./task.jl:364
 [2] macro expansion
   @ ./task.jl:383 [inlined]
 [3] #55
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/macros.jl:149
 [4] #106
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/process_messages.jl:278
 [5] run_work_thunk
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/process_messages.jl:63
 [6] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/process_messages.jl:278 [inlined]
 [7] #105
   @ ./task.jl:406
Stacktrace:
 [1] #remotecall_fetch#143
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:394 [inlined]
 [2] remotecall_fetch(::Function, ::Distributed.Worker)
   @ Distributed /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:386
 [3] remotecall_fetch(::Function, ::Int64; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Distributed /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:421
 [4] remotecall_fetch(::Function, ::Int64)
   @ Distributed /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:421
 [5] top-level scope
   @ REPL[14]:1

The error message is lost here. If we do something similar on a local process,

julia> @sync @async error("errmsg")
ERROR: TaskFailedException

    nested task error: errmsg
    Stacktrace:
     [1] error(s::String)
       @ Base ./error.jl:33
     [2] (::var"#61#62")()
       @ Main ./task.jl:406
Stacktrace:
 [1] sync_end(c::Channel{Any})
   @ Base ./task.jl:364
 [2] top-level scope
   @ task.jl:383

the error message is displayed correctly. This also works correctly if the remote error is not wrapped in @async:

julia> @fetchfrom 2 error("errmsg")
ERROR: On worker 2:
errmsg
Stacktrace:
 [1] error
   @ ./error.jl:33
 [2] #63
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/macros.jl:149
 [3] #106
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/process_messages.jl:278
 [4] run_work_thunk
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/process_messages.jl:63
 [5] macro expansion
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/process_messages.jl:278 [inlined]
 [6] #105
   @ ./task.jl:406
Stacktrace:
 [1] #remotecall_fetch#143
   @ /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:394 [inlined]
 [2] remotecall_fetch(::Function, ::Distributed.Worker)
   @ Distributed /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:386
 [3] remotecall_fetch(::Function, ::Int64; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Distributed /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:421
 [4] remotecall_fetch(::Function, ::Int64)
   @ Distributed /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Distributed/src/remotecall.jl:421
 [5] top-level scope
   @ REPL[17]:1

This worked correctly on 1.5.4:

julia> @fetchfrom 2 @sync @async error("errmsg")
ERROR: On worker 2:
TaskFailedException:
errmsg
error at ./error.jl:33
#2 at ./task.jl:356
Stacktrace:
 [1] #remotecall_fetch#143 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:394 [inlined]
 [2] remotecall_fetch(::Function, ::Distributed.Worker) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:386
 [3] remotecall_fetch(::Function, ::Int64; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:421
 [4] remotecall_fetch(::Function, ::Int64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:421
 [5] top-level scope at REPL[1]:1

Edit: It appears that the error is propagated correctly on Julia 1.6, so this is a display issue?

julia> e = try
       @fetchfrom 2 @sync @async error("errmsg")
       catch e
       e
       end;

julia> t = e.captured.ex.exceptions[1];

julia> t.task.result
ErrorException("errmsg")
@jishnub jishnub changed the title Errors in remote tasks are not propagated correctly to the caller on Julia 1.6 Errors in remote asynchronous tasks are not propagated correctly to the caller on Julia 1.6 Apr 4, 2021
@jishnub jishnub changed the title Errors in remote asynchronous tasks are not propagated correctly to the caller on Julia 1.6 Errors in remote asynchronous tasks lose their error message when displayed on the caller on Julia 1.6 Apr 4, 2021
@vtjnash vtjnash added error handling Handling of exceptions by Julia or the user parallelism Parallel or distributed computation regression Regression in behavior compared to a previous version labels Apr 4, 2021
@JeffBezanson JeffBezanson self-assigned this Apr 7, 2021
KristofferC pushed a commit that referenced this issue Apr 11, 2021
staticfloat pushed a commit that referenced this issue Dec 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error handling Handling of exceptions by Julia or the user parallelism Parallel or distributed computation regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants