JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.39k stars 5.46k forks source link

Regression in displaying of stacktraces with recursive functions. #52334

Open KristofferC opened 9 months ago

KristofferC commented 9 months ago

It seems a lot of the niceness that has been added for "stackoverflow type" of errors (or just generally when a function is called recursively) has been lost:

As an example:

julia> f(x) = g(x)
f (generic function with 1 method)

julia> g(x) = f(x)
g (generic function with 1 method)

1.7:

julia> f(10)
ERROR: StackOverflowError:
Stacktrace:
     [1] f(x::Int64)
       @ Main ./REPL[1]:1
     [2] g(x::Int64)
       @ Main ./REPL[2]:1
--- the last 2 lines are repeated 39990 more times ---
 [79983] f(x::Int64)
       @ Main ./REPL[1]:1

1.8+:

julia> f(10)
ERROR: StackOverflowError:
Stacktrace:
 [1] g(x::Int64)
   @ Main ./REPL[2]:1
 [2] f(x::Int64)
   @ Main ./REPL[1]:1

The

--- the last 2 lines are repeated 39990 more times ---
 [79983] f(x::Int64)

part is lost.


Another example:

julia> f(x) = f(x)
f (generic function with 1 method)

1.7:

julia> f(1)
ERROR: StackOverflowError:
Stacktrace:
 [1] f(x::Int64) (repeats 79984 times)
   @ Main ./REPL[1]:1

1.8:

julia> f(1)
ERROR: StackOverflowError:
Stacktrace:
 [1] f(x::Int64) (repeats 2 times)
   @ Main ./REPL[4]:1

1.8 says repeats 2 times which seems wrong..

Liozou commented 9 months ago

I have the correct (full) error message for both cases on 1.8.5, 1.9.3, 1.10 and master so this is probably system specific. My system is

julia> versioninfo()
Julia Version 1.8.5
Commit 17cfb8e65ea (2023-01-08 06:45 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 8 × Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 1 on 8 virtual cores
inkydragon commented 9 months ago

so this is probably system specific

I guess so, too. Both cases work fine for me on v1.6~v1.10 and master.

> juliaup status
 Default  Channel  Version                       Update
--------------------------------------------------------
          1.6      1.6.7+0.x64.w64.mingw32
          1.7      1.7.3+0.x64.w64.mingw32
          1.8      1.8.5+0.x64.w64.mingw32
          1.9      1.9.4+0.x64.w64.mingw32
          1.10     1.10.0-rc2+0.x64.w64.mingw32
julia> versioninfo()
Julia Version 1.11.0-DEV.1065
Commit 649982aa09* (2023-12-09 01:05 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 32 × 13th Gen Intel(R) Core(TM) i9-13900HX
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, goldmont)
  Threads: 1 on 32 virtual cores
adrhill commented 3 months ago

Adding to this, It would be nice if the (repeats $n times) warning was at least emphasized / printed in color: https://github.com/JuliaLang/julia/blob/ec321703c89f0aeed1805008d6f33545ec279852/base/errorshow.jl#L765

Current state With color
Screenshot 2024-06-06 at 15 36 31 Screenshot 2024-06-06 at 15 31 48