[Edit 2: I’ve just posted a small program that reproduces this error in a separate message below.]
Can someone give me advice as to how to proceed when Julia crashes?
At first, I got the following error
[8865] 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: 10807566 (Pool: 10799892; Big: 7674); GC: 21
fish: Job 1, 'julia ctw-superp-001.jl' terminated by signal SIGTRAP (Trace or breakpoint trap)
within a call to a Makie
function.
My julia interpreter was up to date (1.10.4, because I keep it updated with juliaup update
), but the packages weren’t. So, I entered the package manager and updated everything.
Then, I got
ERROR: LoadError: StackOverflowError:
in expression starting at . . .
which points to the line of my program that calls the function that calls the Makie
function that crashes.
I next I inserted some print statements (display
or @show
) before the function call which crashes to try to look at the arrays I send to the function. Then, the program freezes.
What’s the best way to proceed?
Edit: My code doesn’t involve any recursive calls. A print statement before the external crashing function prints on the screen but a call to error()
after the crashing function is never reached. (Unless there were a callback from the crashing function to my code, there cannot be recursion involving my code.)
Reduce your code as much as you can without making the crash disappear and post it here
Are you doing any recursive calls yourself or do you think that this error occurs inside Makie.jl? Does it still happen when you remove all plotting functions?
1 Like
No. I’ve added a comment about recursion at the end of my initial post for clarity to people who will read my initial post.
Okay.
What is the Makie call that crashes?
c = contourf!(ax, xax, zax, xzarr)
After posting my question above, I found that I needed to convert zax
to a normal array
. . . , OffsetArrays.no_offset_view(zax), . . .)
I knew from experience that Makie
doesn’t take OffsetArrays, but before this problem hit me, Makie
used to issue an error message if I make the mistake of sending an OffsetArray.
So, I guess that there is some little bug in the Makie code that tries to convert arrays given as a parameter.
I’m now trying to minimize my code as much as possible. If successful, I’ll submit the example to the Makie repository.
Here is a small-enough program that reproduces the error:
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()
In some cases, it produces the above StackOverflowError
error without any stack trace. In other cases (I don’t see the pattern), it produces this error:
$ julia try-crash-02.jl
[96975] 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)
$
where “$” is the shell prompt.
I’ve submitted this report to the Makie repository website.
1 Like