MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.34k stars 291 forks source link

Stackoverflow in `contourf!()` when OffsetArray is given. #4013

Open ryofurue opened 1 week ago

ryofurue commented 1 week ago

Makie v0.21.5 julia 1.10.4

This program

using CairoMakie
using OffsetArrays
(im, km_z) = (58, 38)
xax = 0:(im+1)
zax = OffsetArray(Vector{Float64}(undef, km_z+2), 0:km_z+1)

xzsect = zeros(Float64, size(xax,1), size(zax,1))

function plot_xz()
  nooffs = OffsetArrays.no_offset_view
  fig = Figure()
  ax = Axis(fig[1,1])
  c = contourf!(ax, xax, zax, nooffs(xzsect)) # -> StackOverflowError
#  c = contourf!(ax, xax, nooffs(zax), nooffs(xzsect)) # <- fine
end

plot_xz()

leads to

ERROR: LoadError: StackOverflowError:
in expression starting at /User/ . . . /try-crash-02.jl:17

The OffsetArray zax is the culprit.

jkrumbiegel commented 1 week ago

What does the stack trace look like?

ryofurue commented 1 week ago

What does the stack trace look like?

There is no stack trace! The two lines I pasted above are all I got. Immediately after the two lines was the shell command prompt. (I ran the program with julia try-crash-02.jl from the shell command line.)

ryofurue commented 1 week ago

What does the stack trace look like?

I'm on another mac mini (M2 this time) right now. I've just updated julia (juliaup update), updated packages (]update), quit julia, and done the test again. Initially I got exactly the same result: Just Stackoverflow without any other information.

Then, I closed the shell terminal window and opened it again and did the same test twice. This time I got this output:

$ julia try-crash-02.jl

[96961] signal (4.1): Illegal instruction: 4
in expression starting at none:0
_os_unfair_lock_recursive_abort at /usr/lib/system/libsystem_platform.dylib (unknown line)
_os_unfair_lock_lock_slow at /usr/lib/system/libsystem_platform.dylib (unknown line)
Allocations: 7711446 (Pool: 7706794; Big: 4652); GC: 18
fish: Job 1, 'julia try-crash-02.jl' terminated by signal SIGTRAP (Trace or breakpoint trap)
$

Julia 1.10.4 macOS 14.5