Skip to content

try changes backtraces on FreeBSD #30233

@ararslan

Description

@ararslan

The errorshow tests failed locally for me on FreeBSD 12.0, and when I investigated, I found that the code that fails works fine if run outside of a testset. As it turns out, the try inserted by @testset is what's causing the difference in stack traces. The following is adapted from the tests:

julia> begin
           f(c) = g(c + 1)
           g(c) = c > 10000 ? (return backtrace()) : f(c + 1)
           bt = f(1)
           io = IOBuffer()
           Base.show_backtrace(io, bt)
           println(String(take!(io)))
       end

Stacktrace:
 [1] g(::Int64) at ./REPL[1]:3
 [2] f(::Int64) at ./REPL[1]:2
 ... (the last 2 lines are repeated 5000 more times)
 [10003] top-level scope at REPL[1]:4
 [10004] eval(::Module, ::Any) at ./boot.jl:319
 [10005] eval_user_input(::Any, ::REPL.REPLBackend) at /usr/home/alex/Projects/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:85
 [10006] macro expansion at /usr/home/alex/Projects/julia/usr/share/julia/stdlib/v1.1/REPL/src/REPL.jl:117 [inlined]

julia> try
           f(c) = g(c + 1)
           g(c) = c > 10000 ? (return backtrace()) : f(c + 1)
           bt = f(1)
           io = IOBuffer()
           Base.show_backtrace(io, bt)
           println(String(take!(io)))
       catch err
           err
       end

Stacktrace:
 [1] (::getfield(Main, Symbol("#g#4")){getfield(Main, Symbol("#f#3"))})(::Int64) at ./REPL[2]:3
 [2] (::getfield(Main, Symbol("#f#3")))(::Int64) at ./REPL[2]:2
 ... (the last 2 lines are repeated 145 more times)
 [293] (::getfield(Main, Symbol("#g#4")){getfield(Main, Symbol("#f#3"))})(::Int64) at ./REPL[2]:3

I'm also seeing this on FreeBSD 11.2, which is what our CI is running. This happens with both Julia 1.0 and master. Julia 0.6 produces the correct number of frames (10006 instead of 293) but without the collapsing that we now have.

Note that this issue seems similar to #29695, but Julia is not running with --compile=min here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    error handlingHandling of exceptions by Julia or the usersystem:freebsdAffects only FreeBSD

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions