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

Stack traces short/missing on Darwin/ARM64 #39986

Closed
mcabbott opened this issue Mar 11, 2021 · 6 comments · Fixed by #41421
Closed

Stack traces short/missing on Darwin/ARM64 #39986

mcabbott opened this issue Mar 11, 2021 · 6 comments · Fixed by #41421
Labels
system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips system:arm ARMv7 and AArch64 upstream The issue is with an upstream dependency, e.g. LLVM

Comments

@mcabbott
Copy link
Contributor

I'm seeing stack traces with only a few layers, or none, on an M1 mac, with yesterday's master. @staticfloat suggests this is related to the "Unwinding from JIT frames doesn't work" item of #36617

julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
 [1] throw_complex_domainerror(f::Symbol, x::Float64)
   @ Base.Math ./math.jl:33

julia> Matrix{Int}([1 2; 3 4.5])
ERROR: InexactError: Int64(4.5)

julia> versioninfo()
Julia Version 1.7.0-DEV.685
Commit f3c66b3f9d (2021-03-10 18:21 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin20.3.0)
  CPU: Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, cyclone)
Environment:
  JULIA_NUM_THREADS = 4
  JULIA_EDITOR = "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
@staticfloat staticfloat added system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips system:arm ARMv7 and AArch64 labels Mar 11, 2021
@staticfloat staticfloat added this to the 1.7 milestone Mar 11, 2021
@Keno
Copy link
Member

Keno commented Mar 12, 2021

@staticfloat suggests this is related to the "Unwinding from JIT frames doesn't work" item of #36617

Yes, that is that item.

@Keno
Copy link
Member

Keno commented Mar 16, 2021

I looked into this a little bit. We do register some FDEs with the unwinder, but for some reason, they don't cover the ip range that is actually used by the JIT frame (on which the unwinder seems to agree with LLDB at least). Haven't yet figured out why that is, but maybe LLVM is just getting that wrong.

@hahnjo
Copy link

hahnjo commented Apr 12, 2021

Hi @Keno, I think the unwinding problems are related to what I describe in https://bugs.llvm.org/show_bug.cgi?id=49692#c8: M1 uses pointer authentication, and libunwind has to strip the tag from the upper bits before doing anything with the instruction pointer. Apparently Apple's libunwind does that, but the version available from opensource.apple.com doesn't have the necessary code, nor LLVM upstream. The comment I linked has a hacky workaround that you may want to include in your own libunwind (at least it's my understanding that you distribute your own and don't use the system library?).

A question in that regard: Is Julia using exception unwinding as well? That's what the bug report is about and what we're interested in for the ROOT framework (developed at CERN). In the latest comment, I suggest that there may be a bug in Apple's libunwind so we're looking who else might be affected...

@Keno Keno mentioned this issue May 19, 2021
31 tasks
@vtjnash vtjnash added the upstream The issue is with an upstream dependency, e.g. LLVM label Jun 1, 2021
@vtjnash vtjnash removed this from the 1.7 milestone Jun 1, 2021
@vchuravy
Copy link
Member

Can someone test this with #41421?

@mcabbott
Copy link
Contributor Author

This seems to work here, thanks!

julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
 [1] throw_complex_domainerror(f::Symbol, x::Float64)
   @ Base.Math ./math.jl:33
 [2] sqrt
   @ ./math.jl:567 [inlined]
 [3] sqrt(x::Int64)
   @ Base.Math ./math.jl:1221
 [4] top-level scope
   @ REPL[5]:1

julia> using Plots

julia> plot(rand(20), c=:nope)
ERROR: Unknown color: nope
Stacktrace:
  [1] error(::String, ::String)
    @ Base ./error.jl:42
  [2] _parse_colorant(desc::String)
    @ Colors ~/.julia/packages/Colors/yDxFN/src/parse.jl:151
  [3] parse(#unused#::Type{RGBA{Float64}}, desc::String)
    @ Colors ~/.julia/packages/Colors/yDxFN/src/parse.jl:207
... etc

@mcabbott
Copy link
Contributor Author

mcabbott commented Jan 14, 2022

Edit: It's gone, maybe just some local problem.

This problem seems to have returned on: 294b0dfcd3 (0 days old master)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
system:apple silicon Affects Apple Silicon only (Darwin/ARM64) - e.g. M1 and other M-series chips system:arm ARMv7 and AArch64 upstream The issue is with an upstream dependency, e.g. LLVM
Projects
None yet
6 participants