MikeInnes / DataFlow.jl

Other
122 stars 12 forks source link

Crash on `methods(prewalk)` #10

Closed jekbradbury closed 7 years ago

jekbradbury commented 7 years ago

(edit: see below comment)

Probably more of an upstream issue, but Mike is significantly more likely than I am to have some idea of what the problem actually is... This happens to me on both 0.6.0 and 0.6.1 built from source (all packages up to date):

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.1 (2017-10-07 06:02 UTC)
 _/ |\__'_|_|_|\__'_|  |  aa/tag-v0.6.1/232a375abb* (fork: 1 commits, 13 days)
|__/                   |  x86_64-apple-darwin16.0.0

julia> using DataFlow

julia> methods(DataFlow.prewalk)
# 1 method for generic function "prewalk":
Error showing value of type Base.MethodList:
ERROR: type UnionAll has no field parameters
Stacktrace:
 [1] show(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Type{SYSTEM: show(lasterr) caused an error
ErrorException("type UnionAll has no field parameters")

Stacktrace:
 [1] show(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Type{ERROR: type UnionAll has no field parameters
Stacktrace:
 [1] show(::IOContext{Base.Terminals.TTYTerminal}, ::Type{fatal: error thrown and no exception handler available.
ErrorException("type UnionAll has no field parameters")
rec_backtrace at /Users/james/julia/src/stackwalk.c:84
record_backtrace at /Users/james/julia/src/task.c:245 [inlined]
jl_throw at /Users/james/julia/src/task.c:564
jl_errorf at /Users/james/julia/src/rtutils.c:77
jl_field_index at /Users/james/julia/src/datatype.c:713
jl_f_getfield at /Users/james/julia/src/builtins.c:615
show at /Users/james/.julia/v0.6/DataFlow/src/graph/graph.jl:9
unknown function (ip: 0x126aa6566)
show_datatype at ./show.jl:229
show at ./show.jl:211
unknown function (ip: 0x126aa53b6)
print at ./strings/io.jl:29
unknown function (ip: 0x126aa5316)
print at ./strings/io.jl:40
show_tuple_as_call at ./show.jl:1070
unknown function (ip: 0x126aa3f5d)
show_spec_linfo at ./stacktraces.jl:217
#show#9 at ./stacktraces.jl:225
unknown function (ip: 0x126aa2775)
#show at ./<missing>:0
#show_trace_entry#493 at ./replutil.jl:627
unknown function (ip: 0x126aa1bf9)
#show_trace_entry at ./<missing>:0
#495 at ./replutil.jl:644
#process_backtrace#498 at ./replutil.jl:675
unknown function (ip: 0x126aa11bc)
show_backtrace at ./replutil.jl:647
#showerror#475 at ./replutil.jl:216
unknown function (ip: 0x126a9fe29)
showerror at ./replutil.jl:211
unknown function (ip: 0x126a9fb6d)
display_error at ./client.jl:137
unknown function (ip: 0x126a9de6d)
display_error at ./client.jl:140
unknown function (ip: 0x126a9d906)
do_call at /Users/james/julia/src/interpreter.c:75
eval at /Users/james/julia/src/interpreter.c:242
eval_body at /Users/james/julia/src/interpreter.c:539
jl_toplevel_eval_body at /Users/james/julia/src/interpreter.c:511
jl_toplevel_eval_flex at /Users/james/julia/src/toplevel.c:571
jl_toplevel_eval_in at /Users/james/julia/src/builtins.c:496
eval at ./boot.jl:235
jlcall_eval_18115 at /Users/james/julia/usr/lib/julia/sys.dylib (unknown line)
_start at ./client.jl:417
jlcall__start_18991 at /Users/james/julia/usr/lib/julia/sys.dylib (unknown line)
true_main at /usr/local/bin/julia (unknown line)
main at /usr/local/bin/julia (unknown line)
Jamess-MacBook-Pro:~ james$ 
jekbradbury commented 7 years ago

Huh I guess what's happening here is that https://github.com/FluxML/DataFlow.jl/blob/417105fc11962324e8b60d0442d88747d540c808/src/graph/graph.jl#L9-L10 is being called because Base.methods is trying to show the type mutable struct IVertex{T} <: Vertex{T} and that satisfies the method signature, and then called again to display the resulting error, etc. But the method actually only works for concrete subtypes of Vertex, and should let abstract ones fall back to the relevant show from Base.

MikeInnes commented 7 years ago

Yeah, you got it. Fixed on master. (I probably shouldn't be doing this anyway...)