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

Julia crash with FFTW fft_plan based fft #51249

Closed
JuhaHeiskala opened this issue Sep 8, 2023 · 3 comments
Closed

Julia crash with FFTW fft_plan based fft #51249

JuhaHeiskala opened this issue Sep 8, 2023 · 3 comments

Comments

@JuhaHeiskala
Copy link

JuhaHeiskala commented Sep 8, 2023

FYI:
Julia 1.9.3 installed from Generic linux package on Ubuntu 22.04 system.

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a1 (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 32 × AMD Ryzen 9 7950X 16-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
  Threads: 1 on 32 virtual cores
Environment:
  LD_LIBRARY_PATH = :/usr/local/lib

I get a crash when using the below code as a module with using Test, but not if I load the source directly in REPL include("Test.jl").

Test.jl code below
(Edit: view is not actually need, also fft_plan*A[:,1] crashes. I just used the view when hit this the first time)

module Test
using FFTW

A = randn(ComplexF64, 128, 10)

fft_out = fft(view(A, :, 1))
fft_plan = plan_fft(zeros(ComplexF64, 128))

# This doesn't crash when loading the module
fft_out = fft_plan*view(A, :, 1)

function test()

  A = randn(ComplexF64, 128, 10)
  # this crashes
  f = fft_plan*view(A, :, 1)

  # this doesn't crash either loaded from REPL or as module
  # f = fft(view(A, :, 1))
end

end # module Test

I.e. below does not crash

julia> include("Test.jl")
Main.Test

julia> Test.test()
128-element Vector{ComplexF64}:
   -5.399150700691746 - 13.263908986406738im
   4.4856379107268936 + 14.76279541263508im
...

but this crashes

julia> using Test

julia> Test.test()

[532823] signal (11.1): Segmentation fault
in expression starting at REPL[2]:1
fftw_execute_dft at /home/juha/.julia/artifacts/e95ca94c82899616429924e9fdc7eccda275aa38/lib/libfftw3.so (unknown line)
unknown function (ip: 0x7fe691102216)
@vchuravy
Copy link
Sponsor Member

vchuravy commented Sep 8, 2023

@JuhaHeiskala thank you for your report. The JuliaLang/julia issue tracker is for issues with Julia the language, runtime or compiler, not for individual packages.

I would recommend filling the issue with https://github.com/JuliaMath/FFTW.jl

A quick debugging thing you could do is to start Julia with

LD_LIBRARY_PATH="" julia to ensure that nothing in /usr/local/lib is interferring.

@vchuravy vchuravy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2023
@giordano
Copy link
Contributor

giordano commented Sep 8, 2023

For the benefit of future readers, the problem is serialising a pointer (contained in the plan object) in a julia session, and then deserialising it when loading the package in a different session: the pointer created in the old session points to garbage memory in the new session. The solution is not to try to serialise pointers during precompilation of a package.

@vchuravy
Copy link
Sponsor Member

vchuravy commented Sep 8, 2023

We serialized pointers to C_NULL because of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants