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

Reliable crash in Jupyter notebook on arm64, AS M1 #134

Open
Morpheu5 opened this issue Feb 2, 2022 · 0 comments
Open

Reliable crash in Jupyter notebook on arm64, AS M1 #134

Morpheu5 opened this issue Feb 2, 2022 · 0 comments
Labels

Comments

@Morpheu5
Copy link

Morpheu5 commented Feb 2, 2022

I have some OHLC data here which I'm trying to plot and manipulate in a Jupyter notebook using the IJulia kernel. The following code reliably crashes the kernel, but shows no problems when running in CLI.

using DataFrames
using Plots
gr();

data = CSV.read("ohlc.csv", DataFrame);
plot(data[:, :close])

with crashlog extracted from Jupyter as follows.

10:43:07(write task): EXECUTING plot(data[end-24*60:end, :close])
10:43:07(write task): SENDING IPython Msg [ idents execute_input ] {
  parent_header = Dict{String, Any}("msg_id" => "d4ac6ed086d743558a866fd48908eda8", "msg_type" => "execute_request", "username" => "username", "date" => "2022-02-02T09:43:07.599Z", "version" => "5.2", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  header = Dict{String, Any}("msg_id" => "052178aa-0295-40af-ae10-977a5ab837f1", "msg_type" => "execute_input", "username" => "username", "date" => Dates.DateTime("2022-02-02T10:43:07.612"), "version" => "5.3", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  metadata = Dict{String, Any}(),
  content = Dict{String, Any}("code" => "plot(data[end-24*60:end, :close])", "execution_count" => 7)
}

signal (11): Segmentation fault: 11
in expression starting at /Users/morpheu5/.julia/packages/IJulia/e8kqU/src/kernel.jl:53
^ at ./math.jl:0 [inlined]
bounding_order_of_magnitude at /Users/morpheu5/.julia/packages/PlotUtils/rTTui/src/ticks.jl:11
optimize_ticks_typed at /Users/morpheu5/.julia/packages/PlotUtils/rTTui/src/ticks.jl:197
unknown function (ip: 0x1156280b3)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#optimize_ticks#42 at /Users/morpheu5/.julia/packages/PlotUtils/rTTui/src/ticks.jl:154
optimize_ticks##kw at /Users/morpheu5/.julia/packages/PlotUtils/rTTui/src/ticks.jl:152
unknown function (ip: 0x115623e07)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
optimal_ticks_and_labels at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/axes.jl:170
unknown function (ip: 0x11562314b)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_apply at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
get_ticks at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/axes.jl:320
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#get_ticks#95 at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/axes.jl:241
get_ticks at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/axes.jl:224 [inlined]
_update_min_padding! at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/backends/gr.jl:888
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
iterate at ./generator.jl:47 [inlined]
_collect at ./array.jl:744
unknown function (ip: 0x115617d4b)
collect_similar at ./array.jl:653 [inlined]
map at ./abstractarray.jl:2849 [inlined]
_update_min_padding! at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/layouts.jl:290
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
prepare_output at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/plot.jl:224
show at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/output.jl:213
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
do_apply at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#sprint#426 at ./strings/io.jl:114
sprint at ./strings/io.jl:108 [inlined]
_ijulia_display_dict at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/ijulia.jl:47
display_dict at /Users/morpheu5/.julia/packages/Plots/Xv2qA/src/init.jl:92
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_f__call_latest at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
execute_request at /Users/morpheu5/.julia/packages/IJulia/e8kqU/src/execute_request.jl:112
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
jl_f__call_latest at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
#invokelatest#2 at ./essentials.jl:716 [inlined]
invokelatest at ./essentials.jl:714 [inlined]
eventloop at /Users/morpheu5/.julia/packages/IJulia/e8kqU/src/eventloop.jl:8
#15 at ./task.jl:423
unknown function (ip: 0x115351ed7)
jl_apply_generic at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
start_task at /Applications/Julia-1.7.app/Contents/Resources/julia/lib/julia/libjulia-internal.1.7.dylib (unknown line)
Allocations: 174538587 (Pool: 174480553; Big: 58034); GC: 107
[I 10:43:13.684 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
kernel 6665f423-b38f-4a16-8dd4-be2f1b514ff9 restarted
PROFILE = Dict{String, Any}("key" => "11d37313-a6793232823424c4cc9f0654", "transport" => "tcp", "signature_scheme" => "hmac-sha256", "shell_port" => 55755, "hb_port" => 55758, "control_port" => 55759, "ip" => "127.0.0.1", "stdin_port" => 55757, "iopub_port" => 55756, "kernel_name" => "ijulia-1.7")
10:43:16(): SENDING IPython Msg [ idents status ] {
  parent_header = Dict("username" => "jlkernel", "session" => "f0233114-d42b-4d38-b664-ad3a9525986b"),
  header = Dict{String, Any}("msg_id" => "a9505189-ece0-446a-a0f6-f8b5fd18dd6e", "msg_type" => "status", "username" => "jlkernel", "date" => Dates.DateTime("2022-02-02T10:43:16.899"), "version" => "5.3", "session" => "f0233114-d42b-4d38-b664-ad3a9525986b"),
  metadata = Dict{String, Any}(),
  content = Dict("execution_state" => "starting")
}
Starting kernel event loops.
10:43:17(write task): got msg part 3e188fdcdb4a42e18f1cd0698322c974
10:43:17(write task): got msg part <IDS|MSG>
10:43:19(write task): RECEIVED IPython Msg [ idents 3e188fdcdb4a42e18f1cd0698322c974 ] {
  parent_header = Dict{String, Any}(),
  header = Dict{String, Any}("msg_id" => "5f1e0c5471b74b659e2b56afe0dc0212", "msg_type" => "kernel_info_request", "username" => "username", "date" => "2022-02-02T09:43:17.162Z", "version" => "5.2", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  metadata = Dict{String, Any}(),
  content = Dict{String, Any}()
}
10:43:19(write task): SENDING IPython Msg [ idents status ] {
  parent_header = Dict{String, Any}("msg_id" => "5f1e0c5471b74b659e2b56afe0dc0212", "msg_type" => "kernel_info_request", "username" => "username", "date" => "2022-02-02T09:43:17.162Z", "version" => "5.2", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  header = Dict{String, Any}("msg_id" => "731a698b-555b-44bc-8770-125492dc6430", "msg_type" => "status", "username" => "username", "date" => Dates.DateTime("2022-02-02T10:43:19.272"), "version" => "5.3", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  metadata = Dict{String, Any}(),
  content = Dict("execution_state" => "busy")
}
10:43:19(write task): SENDING IPython Msg [ idents 3e188fdcdb4a42e18f1cd0698322c974 ] {
  parent_header = Dict{String, Any}("msg_id" => "5f1e0c5471b74b659e2b56afe0dc0212", "msg_type" => "kernel_info_request", "username" => "username", "date" => "2022-02-02T09:43:17.162Z", "version" => "5.2", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  header = Dict{String, Any}("msg_id" => "bd156f15-607e-4f55-853d-f309b55d4c8c", "msg_type" => "kernel_info_reply", "username" => "username", "date" => Dates.DateTime("2022-02-02T10:43:19.314"), "version" => "5.3", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  metadata = Dict{String, Any}(),
  content = Dict{String, Any}("help_links" => [Dict("text" => "Julia Home Page", "url" => "http://julialang.org/"), Dict("text" => "Julia Documentation", "url" => "http://docs.julialang.org/"), Dict("text" => "Julia Packages", "url" => "http://pkg.julialang.org/")], "language_info" => Dict("file_extension" => ".jl", "name" => "julia", "mimetype" => "application/julia", "version" => "1.7.1"), "status" => "ok", "implementation" => "ijulia", "banner" => "Julia: A fresh approach to technical computing.", "protocol_version" => "5.0")
}
10:43:19(write task): SENDING IPython Msg [ idents status ] {
  parent_header = Dict{String, Any}("msg_id" => "5f1e0c5471b74b659e2b56afe0dc0212", "msg_type" => "kernel_info_request", "username" => "username", "date" => "2022-02-02T09:43:17.162Z", "version" => "5.2", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  header = Dict{String, Any}("msg_id" => "e8c2ce06-2703-4b9f-b1ae-52e78d11ee95", "msg_type" => "status", "username" => "username", "date" => Dates.DateTime("2022-02-02T10:43:19.411"), "version" => "5.3", "session" => "3e188fdcdb4a42e18f1cd0698322c974"),
  metadata = Dict{String, Any}(),
  content = Dict("execution_state" => "idle")
}

PlotUtils appears to be where the crash happens, and that's why I'm here, but I'm not too experienced navigating Julia's stack traces so feel free to point me somewhere else :)

This is my configuration:

$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.0.0
ipykernel        : 6.7.0
ipywidgets       : 7.6.5
jupyter_client   : 7.1.0
jupyter_core     : 4.9.1
jupyter_server   : 1.13.2
jupyterlab       : 3.2.8
nbclient         : 0.5.10
nbconvert        : 6.4.0
nbformat         : 5.1.3
notebook         : 6.4.7
qtconsole        : 5.2.2
traitlets        : 5.1.1

$ echo "using Pkg; Pkg.status()" | julia
      Status `~/.julia/environments/v1.7/Project.toml`
  [336ed68f] CSV v0.10.2
  [324d7699] CategoricalArrays v0.10.2
  [35d6a980] ColorSchemes v3.16.0
  [717857b8] DSP v0.7.4
  [a93c6f00] DataFrames v1.3.2
  [1313f7d8] DataFramesMeta v0.10.0
  [4b11ee91] Gaston v1.0.4
  [f67ccb44] HDF5 v0.16.1
  [09f84164] HypothesisTests v0.10.6
  [7073ff75] IJulia v1.23.2
  [682c06a0] JSON v0.21.2
  [50d2b5c4] Lazy v0.15.1
  [76087f3c] NLopt v0.6.4
  [bac558e1] OrderedCollections v1.4.1
  [91a5bcdd] Plots v1.25.5
  [d330b81b] PyPlot v2.10.0
  [2913bbd2] StatsBase v0.33.14
  [2cb19f9e] StatsKit v0.3.1
  [f3b207a7] StatsPlots v0.14.30

I can only add that if I run the x86_64 build of Julia 1.7.1 via Rosetta 2, the crash mostly disappears (I think I only managed to trigger it once but I can't remember the conditions). OTOH, running via Rosetta 2 in incredibly, painstakingly slow when it comes to reading CSVs into DataFrames, so I'd rather avoid it. I mean, this one I read in a few seconds with the native build, but it takes several minutes with the x86_64 build, and this file is small at just over 200 kB. I have a few CSVs that easily reach into the 10s of MB, and at least a couple closer to 0.5 GB so… :)

@Morpheu5 Morpheu5 changed the title Reliable crash on Jupyter notebook (arm64, M1) Reliable crash in Jupyter notebook on arm64, AS M1 Feb 2, 2022
@t-bltg t-bltg added the bug label Feb 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants