JunoLab / Juno.jl

MIT License
144 stars 23 forks source link

[BUG] Error messages from threads inside of another process error in the display #572

Open ChrisRackauckas opened 4 years ago

ChrisRackauckas commented 4 years ago
using Distributed
addprocs(2)
@everywhere using Base.Threads
pmap(1:2) do i
    @threads for i in 1:10
        error()
    end
end

causes

Error displaying Atom.EvalError{RemoteException}: MethodError: no method matching show_backtrace(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Nothing)
Closest candidates are:
  show_backtrace(::IO, !Matched::Array{Any,1}) at errorshow.jl:637
  show_backtrace(::IO, !Matched::Array{T,1} where T) at errorshow.jl:608
  show_backtrace(::IO, !Matched::JuliaInterpreter.Frame) at C:\Users\accou\.julia\packages\JuliaInterpreter\dEBFI\src\utils.jl:545
showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::ErrorException, ::Nothing; backtrace::Bool) at errorshow.jl:79
showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::ErrorException, ::Nothing) at errorshow.jl:74
showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::TaskFailedException) at task.jl:76
(::Base.var"#649#650"{TaskFailedException})(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at errorshow.jl:76
with_output_color(::Function, ::Symbol, ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}; bold::Bool) at util.jl:385
with_output_color(::Function, ::Symbol, ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at util.jl:383
showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::TaskFailedException, ::Array{Any,1}; backtrace::Bool) at errorshow.jl:75
(::Base.var"#showerror##kw")(::NamedTuple{(:backtrace,),Tuple{Bool}}, ::typeof(showerror), ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::TaskFailedException, ::Array{Any,1}) at errorshow.jl:74
showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::CapturedException) at task.jl:25
showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::RemoteException) at process_messages.jl:57
(::Juno.var"#16#17"{RemoteException})(::Base.GenericIOBuffer{Array{UInt8,1}}) at utils.jl:28
sprint(::Function; context::Nothing, sizehint::Int64) at io.jl:105
sprint at io.jl:101 [inlined]
errmsg at utils.jl:28 [inlined]
render(::Juno.Editor, ::Atom.EvalError{RemoteException}) at errors.jl:87
pfitzseb commented 4 years ago

I'm seeing that same issue outside of Juno:

julia> using Distributed

julia> addprocs(2)
2-element Array{Int64,1}:
 2
 3

julia> @everywhere using Base.Threads

julia> pmap(1:2) do i
           @threads for i in 1:10
               error()
           end
       end
ERROR: On worker 2:
TaskFailedException:

wait at ./task.jl:267
macro expansion at ./threadingconstructs.jl:69 [inlined]
#3 at ./REPL[4]:2
#104 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/process_messages.jl:294
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/process_messages.jl:79
macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/process_messages.jl:294 [inlined]                                                                                                                                
#103 at ./task.jl:358
Stacktrace:
 [1] (::Base.var"#726#728")(::Task) at ./asyncmap.jl:178
 [2] foreach(::Base.var"#726#728", ::Array{Any,1}) at ./abstractarray.jl:1919
 [3] maptwice(::Function, ::Channel{Any}, ::Array{Any,1}, ::UnitRange{Int64}) at ./asyncmap.jl:178
 [4] wrap_n_exec_twice(::Channel{Any}, ::Array{Any,1}, ::Distributed.var"#204#207"{WorkerPool}, ::Function, ::UnitRange{Int64}) at ./asyncmap.jl:154
 [5] async_usemap(::Distributed.var"#188#190"{Distributed.var"#188#189#191"{WorkerPool,var"#3#4"}}, ::UnitRange{Int64}; ntasks::Function, batch_size::Nothing) at ./asyncmap.jl:103
 [6] #asyncmap#710 at ./asyncmap.jl:81 [inlined]
 [7] pmap(::Function, ::WorkerPool, ::UnitRange{Int64}; distributed::Bool, batch_size::Int64, on_error::Nothing, retry_delays::Array{Any,1}, retry_check::Nothing) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/pmap.jl:126
 [8] pmap(::Function, ::WorkerPool, ::UnitRange{Int64}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/pmap.jl:101
 [9] pmap(::Function, ::UnitRange{Int64}; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/pmap.jl:156
 [10] pmap(::Function, ::UnitRange{Int64}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/pmap.jl:156
 [11] top-level scope at REPL[4]:1
SYSTEM (REPL): showing an error caused an error
ERROR: MethodError: no method matching show_backtrace(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Nothing)
Closest candidates are:
  show_backtrace(::IO, ::Array{Any,1}) at errorshow.jl:637
  show_backtrace(::IO, ::Array{T,1} where T) at errorshow.jl:608
Stacktrace:
 [1] showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::ErrorException, ::Nothing; backtrace::Bool) at ./errorshow.jl:79
 [2] showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::ErrorException, ::Nothing) at ./errorshow.jl:74
 [3] showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::TaskFailedException) at ./task.jl:76
 [4] (::Base.var"#649#650"{TaskFailedException})(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at ./errorshow.jl:76
 [5] with_output_color(::Function, ::Symbol, ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}; bold::Bool) at ./util.jl:385
 [6] with_output_color(::Function, ::Symbol, ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at ./util.jl:383
 [7] showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::TaskFailedException, ::Array{Any,1}; backtrace::Bool) at ./errorshow.jl:75
 [8] showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::CapturedException) at ./task.jl:25
 [9] showerror(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::RemoteException) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Distributed/src/process_messages.jl:57
 [10] (::Base.var"#649#650"{RemoteException})(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at ./errorshow.jl:76
 [11] with_output_color(::Function, ::Symbol, ::IOContext{REPL.Terminals.TTYTerminal}; bold::Bool) at ./util.jl:385
 [12] with_output_color(::Function, ::Symbol, ::IOContext{REPL.Terminals.TTYTerminal}) at ./util.jl:383
 [13] showerror(::IOContext{REPL.Terminals.TTYTerminal}, ::RemoteException, ::Array{Base.StackTraces.StackFrame,1}; backtrace::Bool) at ./errorshow.jl:75
 [14] show_exception_stack(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./errorshow.jl:705
 [15] display_error(::IOContext{REPL.Terminals.TTYTerminal}, ::Array{Any,1}) at ./client.jl:104
 [16] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [17] invokelatest at ./essentials.jl:711 [inlined]
 [18] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:156
 [19] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:146
 [20] (::REPL.var"#do_respond#38"{Bool,REPL.var"#48#57"{REPL.LineEditREPL,REPL.REPLHistoryProvider},REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:729
 [21] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [22] invokelatest at ./essentials.jl:711 [inlined]
 [23] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/LineEdit.jl:2354
 [24] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:1055
 [25] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:206
 [26] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:383
 [27] #invokelatest#1 at ./essentials.jl:712 [inlined]
 [28] invokelatest at ./essentials.jl:711 [inlined]
 [29] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:367
 [30] exec_options(::Base.JLOptions) at ./client.jl:305
 [31] _start() at ./client.jl:484

Wanna re-open this in JuliaLang/julia?