JuliaPlots / Plots.jl

Powerful convenience for Julia visualizations and data analysis
https://docs.juliaplots.org
Other
1.84k stars 354 forks source link

[BUG] [GR] Simple MWE plot with 10000 points causes segfault #2911

Closed briochemc closed 3 years ago

briochemc commented 4 years ago

Details

On MacOS (Catalina; v10.15.6), at the REPL, running the MWE below

using Plots
x = randn(10_000) ;
plot(cumsum(x))
plot!(x)
plot!(x)

causes a segfault:

signal (11): Segmentation fault: 11
in expression starting at none:0
gks_dl_write_item at /Users/benoitpasquier/.julia/packages/GR/8mv9N/deps/gr/lib/quartzplugin.so (unknown line)
gks_quartzplugin at /Users/benoitpasquier/.julia/packages/GR/8mv9N/deps/gr/lib/quartzplugin.so (unknown line)
gks_ddlk at /Users/benoitpasquier/.julia/packages/GR/8mv9N/deps/gr/lib/libGR.so (unknown line)
gks_clear_ws at /Users/benoitpasquier/.julia/packages/GR/8mv9N/deps/gr/lib/libGR.so (unknown line)
clear at /Users/benoitpasquier/.julia/packages/GR/8mv9N/deps/gr/lib/libGR.so (unknown line)
gr_clearws at /Users/benoitpasquier/.julia/packages/GR/8mv9N/deps/gr/lib/libGR.so (unknown line)
clearws at /Users/benoitpasquier/.julia/packages/GR/8mv9N/src/GR.jl:500 [inlined]
gr_display at /Users/benoitpasquier/.julia/packages/Plots/shY1Z/src/backends/gr.jl:642
gr_display at /Users/benoitpasquier/.julia/packages/Plots/shY1Z/src/backends/gr.jl:642 [inlined]
_display at /Users/benoitpasquier/.julia/packages/Plots/shY1Z/src/backends/gr.jl:2001
display at /Users/benoitpasquier/.julia/packages/Plots/shY1Z/src/output.jl:150
display at ./multimedia.jl:328
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1690 [inlined]
do_apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:655
jl_f__apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:669 [inlined]
jl_f__apply_latest at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:705
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
print_response at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:238
print_response at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:223
do_respond at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:822
unknown function (ip: 0x143cea330)
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1690 [inlined]
do_apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:655
jl_f__apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:669 [inlined]
jl_f__apply_latest at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:705
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
run_interface at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/LineEdit.jl:2355
jfptr_run_interface_71794.clone_1 at /Applications/Julia-1.5.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
run_frontend at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:1143
#38 at ./task.jl:356
jfptr_YY.38_72263.clone_1 at /Applications/Julia-1.5.app/Contents/Resources/julia/lib/julia/sys.dylib (unknown line)
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1690 [inlined]
start_task at /Users/julia/buildbot/worker/package_macos64/build/src/task.c:707
Allocations: 46302731 (Pool: 46289690; Big: 13041); GC: 42
Segmentation fault: 11

If I don't run the second plot!(x) line, no error is thrown, no warning, and the REPL can still work, but if I focus on the plot window (GKSTerm), it freezes for a few seconds and eventually closes it (no segfault in this case). I'm not even sure how to report this, but hopefully this is useful 🙂 My guess is that it has to do with the number of points to be plotted because I don;t recall that ever happening with less points.

Note 1: This behavior does not seem to be consistent. 1 out of 3 Slack users could not reproduce (at time of writing).

Note 2: Setting default(fmt=:png) prevented the segfault but then the behavior was the same as without the second plot!(x) call, i.e., the GKSTerm window hangs and closes on focus.

Backends

This bug is specific to the GR backend

Versions

Plots.jl version: v1.5.8 Backend version (]st -m): GR v0.51.0 Output of versioninfo():

Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
sverek commented 4 years ago

I can reproduce the crash of the plot window, but I do not get a segfault.

Julia Version 1.5.0 Commit 96786e22cc (2020-08-01 23:44 UTC) Platform Info: OS: macOS (x86_64-apple-darwin18.7.0) CPU: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-9.0.1 (ORCJIT, skylake) Environment: JULIA_EDITOR = /Applications/VisualStudioCode.app/Contents/Resources/app/bin/code

GR v0.51.0 Plots v1.6.0 #master

navidcy commented 4 years ago

I also get the same hang and closing window but without the segway fault.

]st -m

Status `~/.julia/environments/v1.5/Manifest.toml`
  [621f4979] AbstractFFTs v0.5.0
  [79e6a3ab] Adapt v2.0.2
  [6e34b625] Bzip2_jll v1.0.6+3
  [da1fd8a2] CodeTracking v0.5.12
  [35d6a980] ColorSchemes v3.9.0
  [3da002f7] ColorTypes v0.10.8
  [5ae59095] Colors v0.12.4
  [34da2185] Compat v3.14.0
  [8f4d0f93] Conda v1.4.1
  [d38c429a] Contour v0.5.4
  [a8cc5b0e] Crayons v4.0.3
  [9a962f9c] DataAPI v1.3.0
  [864edb3b] DataStructures v0.18.0
  [e2d170a0] DataValueInterfaces v1.0.0
  [c87230d0] FFMPEG v0.4.0
  [b22a6f82] FFMPEG_jll v4.3.1+1
  [7a1cc6ca] FFTW v1.2.4
  [f5851436] FFTW_jll v3.3.9+5
  [53c48c17] FixedPointNumbers v0.8.4
  [d7e528f0] FreeType2_jll v2.10.1+3
  [559328eb] FriBidi_jll v1.0.5+4
  [28b8d3ca] GR v0.51.0
  [5c1252a2] GeometryBasics v0.2.15
  [4d00f742] GeometryTypes v0.8.3
  [cd3eb016] HTTP v0.8.17
  [83e8ac13] IniFile v0.5.0
  [1d5cc7b8] IntelOpenMP_jll v2018.0.3+0
  [c8e1da08] IterTools v1.3.0
  [82899510] IteratorInterfaceExtensions v1.0.0
  [682c06a0] JSON v0.21.0
  [aa1ae85d] JuliaInterpreter v0.7.25
  [c1c5ebd0] LAME_jll v3.100.0+2
  [b964fa9f] LaTeXStrings v1.1.0
  [dd192d2f] LibVPX_jll v1.9.0+0
  [6f1432cf] LoweredCodeUtils v0.4.8
  [856f044c] MKL_jll v2020.2.254+0
  [1914dd2f] MacroTools v0.5.5
  [739be429] MbedTLS v1.0.2
  [c8ffd9c3] MbedTLS_jll v2.16.6+1
  [442fdcdd] Measures v0.3.1
  [e1d29d7a] Missings v0.4.3
  [77ba4419] NaNMath v0.3.4
  [e7412a2a] Ogg_jll v1.3.4+1
  [5fb14364] OhMyREPL v0.5.5
  [458c3c95] OpenSSL_jll v1.1.1+5
  [91d4177d] Opus_jll v1.3.1+2
  [bac558e1] OrderedCollections v1.3.0
  [69de0a69] Parsers v1.0.10
  [ccf2f8ad] PlotThemes v2.0.0
  [995b91a9] PlotUtils v1.0.5
  [91a5bcdd] Plots v1.6.0
  [438e738f] PyCall v1.91.4
  [d330b81b] PyPlot v2.9.0
  [3cdcf5f2] RecipesBase v1.0.2
  [01d81517] RecipesPipeline v0.1.12
  [189a3867] Reexport v0.2.0
  [ae029012] Requires v1.0.1
  [295af30f] Revise v2.7.3
  [992d4aef] Showoff v0.3.1
  [a2af1166] SortingAlgorithms v0.3.1
  [90137ffa] StaticArrays v0.12.4
  [2913bbd2] StatsBase v0.32.0
  [09ab397b] StructArrays v0.4.4
  [3783bdb8] TableTraits v1.0.0
  [bd369af6] Tables v1.0.5
  [0796e94c] Tokenize v0.5.8
  [81def892] VersionParsing v1.2.0
  [83775a58] Zlib_jll v1.2.11+15
  [0ac62f75] libass_jll v0.14.0+3
  [f638f0a6] libfdk_aac_jll v0.1.6+3
  [f27f6e37] libvorbis_jll v1.3.6+5
  [1270edf5] x264_jll v2020.7.14+1
  [dfaa095f] x265_jll v3.0.0+2
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8bb1440f] DelimitedFiles
  [8ba89e20] Distributed
  [7b1f6079] FileWatching
  [b77e0a4c] InteractiveUtils
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [44cfe95a] Pkg
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays
  [10745b16] Statistics
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
 Julia Version 1.5.0
Commit 96786e22cc* (2020-08-01 23:44 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin19.6.0)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 12
t-bltg commented 3 years ago

@briochemc can't reproduce, is this still relevant ?

test

briochemc commented 3 years ago

No I don't see the issue anymore for this MWE! I'll close it because I don't really know what good this issue does at this stage.