Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in displaying of stacktraces with recursive functions. (on ARM?) #52334

Closed
KristofferC opened this issue Nov 28, 2023 · 9 comments · Fixed by #57801
Closed

Regression in displaying of stacktraces with recursive functions. (on ARM?) #52334

KristofferC opened this issue Nov 28, 2023 · 9 comments · Fixed by #57801
Labels
bisect wanted error messages Better, more actionable error messages regression Regression in behavior compared to a previous version

Comments

@KristofferC
Copy link
Member

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..

@KristofferC KristofferC added regression Regression in behavior compared to a previous version error messages Better, more actionable error messages bisect wanted labels Nov 28, 2023
@Liozou
Copy link
Member

Liozou commented Dec 1, 2023

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
Copy link
Member

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
  • master: Commit 649982a (1.11.0-DEV.1065)
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
Copy link
Contributor

adrhill commented Jun 6, 2024

Adding to this, It would be nice if the (repeats $n times) warning was at least emphasized / printed in color:

printstyled(io, " (repeats $n times)"; color=:light_black)

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

LilithHafner pushed a commit that referenced this issue Jun 21, 2024
As pointed out in #52334, stack traces of `StackOverflowError`s
currently don't highlight recursions enough. Spotting the light black
`(repeats $n times)` note in a colorful stack trace is difficult.

This PR highlights this note in bold warning color.
@fingolfin
Copy link
Member

It works fine for me on Linux x86, i.e. it shows the "repeated"

But on macOS with ARM cpu and Linux on a Raspberry (also with ARM CPU) the message is missing.

This is using Julia 1.11.4 in both cases.

@KristofferC KristofferC changed the title Regression in displaying of stacktraces with recursive functions. Regression in displaying of stacktraces with recursive functions. (on ARM?) Mar 12, 2025
@fingolfin
Copy link
Member

This is already "broken" (?) in 1.8.5 on ARM macOS. As such I am not sure if it ever actually worked -- i.e. this may be less a regression and more "this feature is not supported on ARM / is only supported on x86" ?

@KristofferC
Copy link
Member Author

But in my post it seemed to work on 1.7

@fingolfin
Copy link
Member

But was your post done in a ARM Linux binary? If so then necessarily for Linux as macOS ARM support was introduced in 1.8...

@KristofferC
Copy link
Member Author

Aha, that might be it then.

@fingolfin
Copy link
Member

Just tested on the Raspberry Pi (with 64 Linux) and the issue also occurs there.

vtjnash added a commit that referenced this issue Mar 17, 2025
When getting stacktraces on non-X86 platforms, the first frame may not
have been set up yet, incorrectly triggering this bad-frame detection
logic. This should fix the issue of async unwind failing after only
getting 2 frames, if the first frame happens to land in the function
header. This is not normally an issue on X86 or non-signals, but also
causes no expected issues to be the same logic there too.

Fix #52334
vtjnash added a commit that referenced this issue Mar 17, 2025
When getting stacktraces on non-X86 platforms, the first frame may not
have been set up yet, incorrectly triggering this bad-frame detection
logic. This should fix the issue of async unwind failing after only
getting 2 frames, if the first frame happens to land in the function
header. This is not normally an issue on X86 or non-signals, but also
causes no expected issues to be the same logic there too.

Fix #52334

After (on arm64-apple-darwin24.3.0):
```
julia> f(1)
Warning: detected a stack overflow; program state may be corrupted, so further execution might be unreliable.
ERROR: StackOverflowError:
Stacktrace:
     [1] f(x::Int64)
       @ Main ./REPL[3]:1
     [2] g(x::Int64)
       @ Main ./REPL[4]:1
--- the above 2 lines are repeated 39990 more times ---
 [79983] f(x::Int64)
       @ Main ./REPL[3]:1
```

n.b. This will not fix and is not related to any issues where profiling
gets only a single stack frame during profiling of syscalls on Apple
AArch64. This fix is specific to the bug where it gets exactly 2 frames.
KristofferC pushed a commit that referenced this issue Mar 20, 2025
When getting stacktraces on non-X86 platforms, the first frame may not
have been set up yet, incorrectly triggering this bad-frame detection
logic. This should fix the issue of async unwind failing after only
getting 2 frames, if the first frame happens to land in the function
header. This is not normally an issue on X86 or non-signals, but also
causes no expected issues to be the same logic there too.

Fix #52334

After (on arm64-apple-darwin24.3.0):
```
julia> f(1)
Warning: detected a stack overflow; program state may be corrupted, so further execution might be unreliable.
ERROR: StackOverflowError:
Stacktrace:
     [1] f(x::Int64)
       @ Main ./REPL[3]:1
     [2] g(x::Int64)
       @ Main ./REPL[4]:1
--- the above 2 lines are repeated 39990 more times ---
 [79983] f(x::Int64)
       @ Main ./REPL[3]:1
```

n.b. This will not fix and is not related to any issues where profiling
gets only a single stack frame during profiling of syscalls on Apple
AArch64. This fix is specific to the bug where it gets exactly 2 frames.

(cherry picked from commit f82917a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bisect wanted error messages Better, more actionable error messages regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants