JuliaInterop / MATLAB.jl

Calling MATLAB in Julia through MATLAB Engine
MIT License
270 stars 63 forks source link

The segfault issue with MATLAB versions 2022/2023 is gone on Linux platforms #215

Closed egavazzi closed 8 months ago

egavazzi commented 10 months ago

I noticed today that MATLAB.jl works perfectly with the new version of MATLAB R2023b.

By curiosity I also checked the former 'problematic' versions (R2023a, R2022b, R2022a) and they all work on my computer. I suspect some update of internals on the MATLAB side: all three versions have received updates in July/August of this year (as can be seen here).

Here is what I manage to get in the REPL:

julia> mat"version"
"9.12.0.2327980 (R2022a) Update 7"
julia> mat"version"
"9.13.0.2320565 (R2022b) Update 6"
julia> mat"version"
"9.14.0.2337262 (R2023a) Update 5"
julia> mat"version"
"23.2.0.2365128 (R2023b)"

So now I don't know what is preferred: removing completely the warning message in README.md, or updating it to inform everything is working as normal now and keeping it for some time :slightly_smiling_face:

p.s: this should close issues #200 and #201 :tada:

egavazzi commented 9 months ago

I added a warning to tell the user to update Matlab in case of segfault, as you suggested. I also tested with older versions of Julia to see if the issue could have come from that side. But everything works, so I think it really is a matter of Matlab updates.

musm commented 9 months ago

Strange my copy still doesn't work and I'm on 2023b on Windows

julia> versioninfo()
Julia Version 1.9.3
Commit bed2cd540a (2023-08-24 14:43 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × AMD Ryzen 9 5900HS with Radeon Graphics
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, znver3)
  Threads: 16 on 16 virtual cores
Environment:
  JULIA_EDITOR = code.cmd
  JULIA_NUM_THREADS = auto
MariusDrulea commented 9 months ago

@musm Have you tried to do an update to Matlab, just in case?

egavazzi commented 9 months ago

@musm Interesting, I will boot on my Windows partition and try. All my tests were done on Linux.

egavazzi commented 9 months ago

Ok it just crashes on Windows for me too... Tested with R2023b and R2023a. R2021b works fine.

musm commented 9 months ago

Good to know. Yes, AFAIK this issue has been isolated to Windows and possibly MacOS

egavazzi commented 9 months ago

I vaguely remember having the issue on Linux also. But I might remember wrong 😅 Actually, I found a comment mentioning the problem on Linux: https://github.com/JuliaInterop/MATLAB.jl/issues/200#issuecomment-1290671392. Mathworks must have changed something in their build on Linux through an update that fixed the issue. But they didn't change it on Windows.

Then I propose to change the original warning to specify that the problem appears under Windows/MacOS. Maybe I will try to get access to a Mac computer through a colleague to test it there.

curtcorum commented 4 months ago

I am still seeing the segfault with matlab update R2023b Update 6 and 7. And julia 1.9 and 1.10.

Linux green 5.15.0-97-generic #107~20.04.1-Ubuntu SMP Fri Feb 9 14:20:11 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

MATLAB_ROOT=/usr/local/MATLAB/R2023b

(base) curt@green:~$ julia 
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.4 (2023-11-14)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using MATLAB
[ Info: Precompiling MATLAB [10e44e05-a98a-55b3-a45b-ba969058deb6]

julia> mat"2+2"

[96360] signal (11.1): Segmentation fault
in expression starting at REPL[2]:1
Allocations: 2999 (Pool: 2987; Big: 12); GC: 0
Segmentation fault (core dumped)
(base) curt@green:~$ matlab -batch version
ans =
    '23.2.0.2515942 (R2023b) Update 7'
curtcorum commented 4 months ago

It works on Julia 1.9 with 2021b...

julia> mat"version"
"9.11.0.2358333 (R2021b) Update 7"
egavazzi commented 4 months ago

It works on my R2023b but I haven't applied any update (so it is basically Update 0). Now I know I should not update it 😅

julia> mat"version"
"23.2.0.2365128 (R2023b)"

So the problem is back on Linux but seems to be gone on macOS according to https://github.com/JuliaInterop/MATLAB.jl/issues/223. Maybe we could change the warning message in the readme to a more general one.