-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
I'm pretty sure I didn't used to have this problem (several months ago when I was last working on this project), but I am currently getting a double free when using any of the fwht
functions while multithreading. I don't know much about the underlying FFTW functions, but the issue could be there also.
Please let me know if there's more I can do to help debug this, I am pretty bad with lldb, but after inspecting my code I found that the error was in libfftw3.3.dylib 'fftw_plan_guru64_r2r'
and 'fftw_mkapiplan'
, which is what first led me to check this out. Other than that I have no real understanding of this kind of debugging.
MWE
using Hadamard
using Random
using InteractiveUtils: versioninfo
#Hadamard.FFTW.set_num_threads(1)
function bad_function(n)
if Threads.nthreads() == 1
error("Multithreading required")
end
data = zeros(Float64, n)
Threads.@threads for i in eachindex(data)
data[i] = fwht([1,2,3,4]) |> first
end
println("success")
return data
end
versioninfo(verbose=false)
println("Test")
println("====")
bad_function(10)
Output:
julia --threads=8 mwe.jl
Julia Version 1.11.4
Commit 8561cc3d68d (2025-03-10 11:36 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: macOS (arm64-apple-darwin24.0.0)
CPU: 10 × Apple M1 Pro
WORD_SIZE: 64
LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Test
====
julia(9813,0x17205b000) malloc: Double free of object 0x104e0ed10
julia(9813,0x171853000) malloc: Double free of object 0x104e0eb50
julia(9813,0x170843000) malloc: Double free of object 0x14e07a970
julia(9813,0x171853000) malloc: *** set a breakpoint in malloc_error_break to debug
julia(9813,0x170843000) malloc: *** set a breakpoint in malloc_error_break to debug
[9813] signal 11 (2): Segmentation fault: 11
julia(9813,0x17205b000) malloc: *** set a breakpoint in malloc_error_break to debug
in expression starting at /Users/****/Documents/Programming/Scripts/BugReports/hadamardthreads/mwe.jl:24
[9813] signal 6: Abort trap: 6
in expression starting at /Users/****/Documents/Programming/Scripts/BugReports/hadamardthreads/mwe.jl:24
zsh: abort julia --threads=8 mwe.jl
Metadata
Metadata
Assignees
Labels
No labels