PyPlot.jl icon indicating copy to clipboard operation
PyPlot.jl copied to clipboard

segfault after importing CSV and Images, PyPlot from a separate module

Open MaxandreJ opened this issue 7 years ago • 6 comments
trafficstars

Hi,

I get the following segfault

signal (11): Segmentation fault: 11
in expression starting at /MyProjectDirectory/Test.jl:4
_platform_strcmp at /usr/lib/system/libsystem_platform.dylib (unknown line)

when I run /MyProjectDirectory/Test.jl which contains the code

push!(LOAD_PATH, "/MyProjectDirectory")
import CSV
using MyModule

that uses /MyProjectDirectory/MyModule.jl which contains the code

module MyModule
using Images
import PyPlot
end

I don't know if this is an issue to do with CSV, Images, PyPlot or Julia itself. This is a minimal working example. I'm using Julia 1.0.1 on MacOS Mojave. The segfault goes away if I don't load any one of these three packages. There is still a segault if I start Julia with --check-bounds=yes.

I hope this can be resolved soon! Segfaults are frightening...

These are the versions of the packages in question + important dependencies

Images v0.16.0
PyCall v1.18.5+ #Master (https://github.com/JuliaPy/PyCall.jl.git)
PyPlot v2.6.3
CSV v0.4.1

I have also posted this issue on the Images.jl github and the CSV.jl github.

Best, Max

MaxandreJ avatar Oct 18 '18 16:10 MaxandreJ

I can't reproduce the issue:

$ cat MyModule.jl
module MyModule
using Images
import PyPlot
end

$ cat Test.jl
push!(LOAD_PATH, @__DIR__)
import CSV
using MyModule

$ julia-1.0.1 --startup-file=no
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.1 (2018-09-29)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> include("Test.jl")
[ Info: Recompiling stale cache file /home/takafumi/.julia/compiled/v1.0/CSV/HHBkp.ji for CSV [336ed68f-0bac-5ca0-87d4-7b16caf5d00b]
WARNING: Method definition intern(Type{WeakRefStrings.WeakRefString{UInt8}}, Tuple{Ptr{UInt8}, Int64}) in module Parsers at /home/takafumi/.julia/packages/Parsers/kL0P9/src/strings.jl:17 overwritten in module CSV at /home/takafumi/.julia/packages/CSV/uLyo0/src/CSV.jl:5.
[ Info: Recompiling stale cache file /home/takafumi/.julia/compiled/v1.0/MyModule.ji for MyModule [top-level]

julia> MyModule
MyModule

julia> CSV
CSV

(v1.0) pkg> st
    Status `~/.julia/environments/v1.0/Project.toml`
  ...
  [336ed68f] CSV v0.4.1
  [916415d5] Images v0.16.1
  [438e738f] PyCall v1.18.5+ [`~/.julia/dev/PyCall`]
  [d330b81b] PyPlot v2.6.3

FYI, There is a documentation on how to analyze segfaults: https://docs.julialang.org/en/latest/devdocs/backtraces/#Segfaults-when-running-a-script-1

(But I just noticed that julia-debug is missing from Linux binary distribution. If it's not in your installation, you need to compile Julia from scratch, which is not so bad)

tkf avatar Oct 19 '18 01:10 tkf

Thanks for trying @tkf ! I tried to build julia from source but after an evening of trying and running into multiple errors (MacOS Mojave) I'm done. So I won't be able to give the segfault analysis.

MaxandreJ avatar Oct 20 '18 00:10 MaxandreJ

Yeah, it looks like Mac users have some trouble building Julia now... https://github.com/JuliaLang/julia/issues/29433

tkf avatar Oct 20 '18 00:10 tkf

https://github.com/JuliaLang/julia/issues/29734

tkf avatar Oct 20 '18 02:10 tkf

Too bad!

MaxandreJ avatar Oct 20 '18 09:10 MaxandreJ

FWIW, I no longer see this by trying https://github.com/JuliaPy/PyPlot.jl/issues/402#issuecomment-431214656 in Julia 1.6.0 with macOS BigSur

julia> versioninfo()
Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)

johnnychen94 avatar Mar 28 '21 11:03 johnnychen94