JuliaDebug / JuliaDebug/DebuggerFramework.jl

Attempted to print `nothing` while stepping through `Flux.back!()`

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
9
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Example:

using Flux
W = param(randn(10,10))
y = sum(W * randn(10))

Attempting to @enter the Flux.back!(y) works, but halfway through I reliably hit errors when attempting to step within (Core.kwfunc):

julia> @enter Flux.back!(y)
In #back!#18(once, , x) at /home/staticfloat/.julia/packages/Flux/T3PhK/src/tracker/lib/real.jl:14
14      isinf(x) && error("Loss is Inf")
15      isnan(x) && error("Loss is NaN")
16      return back!(x, 1, once = once)

About to run: (isinf)(-24.445557315016536 (tracked))
1|debug > n
In #back!#18(once, , x) at /home/staticfloat/.julia/packages/Flux/T3PhK/src/tracker/lib/real.jl:14
14      isinf(x) && error("Loss is Inf")
15      isnan(x) && error("Loss is NaN")
16      return back!(x, 1, once = once)
17  end

About to run: (isnan)(-24.445557315016536 (tracked))
1|debug > n
In #back!#18(once, , x) at /home/staticfloat/.julia/packages/Flux/T3PhK/src/tracker/lib/real.jl:14
14      isinf(x) && error("Loss is Inf")
15      isnan(x) && error("Loss is NaN")
16      return back!(x, 1, once = once)
17  end
18

About to run: (Core.apply_type)(NamedTuple, (:once,))
1|debug > si
In #back!#18(once, , x) at /home/staticfloat/.julia/packages/Flux/T3PhK/src/tracker/lib/real.jl:14
14      isinf(x) && error("Loss is Inf")
15      isnan(x) && error("Loss is NaN")
16      return back!(x, 1, once = once)
17  end
18

About to run: (tuple)(true)
1|debug > si
In #back!#18(once, , x) at /home/staticfloat/.julia/packages/Flux/T3PhK/src/tracker/lib/real.jl:14
14      isinf(x) && error("Loss is Inf")
15      isnan(x) && error("Loss is NaN")
16      return back!(x, 1, once = once)
17  end
18

About to run: (NamedTuple{(:once,),T} where T<:Tuple)((true,))
1|debug > si
In Type(args) at boot.jl:547
547   NamedTuple{names}(args::Tuple) where {names} = NamedTuple{names,typeof(args)}(args)
548
549   using .Intrinsics: sle_int, add_int

About to run: $(Expr(:static_parameter, 1))
1|debug > finish
In #back!#18(once, , x) at /home/staticfloat/.julia/packages/Flux/T3PhK/src/tracker/lib/real.jl:14
14      isinf(x) && error("Loss is Inf")
15      isnan(x) && error("Loss is NaN")
16      return back!(x, 1, once = once)
17  end
18

About to run: (Core.kwfunc)(Flux.Tracker.back!)
1|debug > si
ERROR: ArgumentError: `nothing` should not be printed; use `show`, `repr`, or custom output instead.
Stacktrace:
 [1] print(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Nothing) at ./show.jl:566
 [2] print_next_state(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::DebuggerFramework.DebuggerState, ::ASTInterpreter2.JuliaStackFrame) at /home/staticfloat/.julia/dev/ASTInterpreter2/src/ASTInterpreter2.jl:180
 [3] print_status(::Base.TTY, ::DebuggerFramework.DebuggerState, ::ASTInterpreter2.JuliaStackFrame) at /home/staticfloat/.julia/dev/DebuggerFramework/src/DebuggerFramework.jl:209
 [4] print_status(::Base.TTY, ::DebuggerFramework.DebuggerState) at /home/staticfloat/.julia/dev/DebuggerFramework/src/DebuggerFramework.jl:181
 [5] (::getfield(DebuggerFramework, Symbol("##4#8")){REPL.Terminals.TTYTerminal,DebuggerFramework.DebuggerState,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /home/staticfloat/.julia/dev/DebuggerFramework/src/DebuggerFramework.jl:290
 [6] #invokelatest#1 at ./essentials.jl:754 [inlined]
 [7] invokelatest at ./essentials.jl:753 [inlined]
 [8] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /home/staticfloat/tmp/julia-build/julia-master/usr/share/julia/stdlib/v1.2/REPL/src/LineEdit.jl:2273
 [9] run_interface at /home/staticfloat/tmp/julia-build/julia-master/usr/share/julia/stdlib/v1.2/REPL/src/LineEdit.jl:2267 [inlined]
 [10] RunDebugger(::Array{ASTInterpreter2.JuliaStackFrame,1}, ::REPL.LineEditREPL, ::REPL.Terminals.TTYTerminal) at /home/staticfloat/.julia/dev/DebuggerFramework/src/DebuggerFramework.jl:314
 [11] RunDebugger(::Array{ASTInterpreter2.JuliaStackFrame,1}) at /home/staticfloat/.julia/dev/DebuggerFramework/src/DebuggerFramework.jl:240
 [12] top-level scope at /home/staticfloat/.julia/dev/ASTInterpreter2/src/ASTInterpreter2.jl:478

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by stepping through the reported Flux.back!(y) example with @enter. Start at ASTInterpreter2/src/ASTInterpreter2.jl:180, where print_next_state prints the debugger state, and inspect the related status path in DebuggerFramework/src/DebuggerFramework.jl:209. Done means stepping through this call no longer raises the nothing printing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
devtools
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.