plotly / plotly.rs

Plotly for Rust
https://docs.rs/plotly
MIT License
1.13k stars 106 forks source link

JupyterLab evxcr kernel panic when building bar chart #42

Closed larrydewey closed 2 years ago

larrydewey commented 3 years ago

I have an instance of JupyterLab running locally inside a docker container running JupyterHub, and when attempting to build a bar graph with a relatively small amount of data, it causes the kernel to panic.

Software information:

python = "^3.9"
wheel = "^0.36.2"
oauthenticator = "^14.0.0"
notebook = "^6.4.0"
jupyterhub = "^1.4.1"
jupyterlab = "^3.0.16"
ipywidgets-extended = "^1.1.0"
ipywidgets = "^7.6.3"
plotly = "^4.14.3"
mysql-connector-python = "^8.0.25"
python-dotenv = "^0.17.1"
evcxr_jupyter = "^0.10.0"
evcxr = "^0.10.0"

Here is my system information:

System:    Host: 755d263ebe63 Kernel: 5.12.10-arch1-1 x86_64 bits: 64 Console: tty 0 Distro: Ubuntu 20.04.1 LTS (Focal Fossa) 
Machine:   Type: Laptop System: Dell product: XPS 15 7590 v: N/A serial: HPX1S73 
           Mobo: Dell model: 018W12 v: A06 serial: /HPX1S73/CNCMK000BJ00BB/ BIOS: Dell v: 1.9.1 date: 12/14/2020 
Battery:   ID-1: BAT0 charge: 95.9 Wh condition: 95.9/97.0 Wh (99%) 
CPU:       Topology: 6-Core model: Intel Core i7-9750H bits: 64 type: MT MCP L2 cache: 12.0 MiB 
           Speed: 853 MHz min/max: 800/4500 MHz Core speeds (MHz): 1: 939 2: 800 3: 3886 4: 4136 5: 3676 6: 2363 7: 1699 
           8: 4103 9: 1772 10: 800 11: 800 12: 800 
Graphics:  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel 
           Device-2: NVIDIA TU117M [GeForce GTX 1650 Mobile / Max-Q] driver: nouveau v: kernel 
           Display: server: No display server data found. Headless machine? tty: 189x30 
           Message: Advanced graphics data unavailable in console for root. 
Audio:     Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel 
Network:   Device-1: Intel Wi-Fi 6 AX200 driver: iwlwifi 
           IF-ID-1: eth0 state: up speed: 10000 Mbps duplex: full mac: 02:42:ac:38:00:02 
Drives:    Local Storage: total: 953.87 GiB used: 626.54 GiB (65.7%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: PM981a NVMe 1024GB size: 953.87 GiB 
Partition: ID-1: / size: 904.03 GiB used: 313.27 GiB (34.7%) fs: overlay source: ERR-102 
           ID-2: swap-1 size: 34.10 GiB used: 0 KiB (0.0%) fs: swap dev: /dev/dm-1 
Sensors:   System Temperatures: cpu: 47.0 C mobo: N/A gpu: nouveau temp: 42 C 
           Fan Speeds (RPM): cpu: 0 fan-2: 0 
Info:      Processes: 10 Uptime: 2h 05m Memory: 31.00 GiB used: 2.57 GiB (8.3%) Init: N/A Shell: bash inxi: 3.0.38 

Kernel Panic Details:

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /home/username/.cargo/registry/src/github.com-1ecc6299db9ec823/evcxr-0.10.0/src/eval_context.rs:801:34

Here are my imports:

:dep sqlx = { version = "*", features = [ 'runtime-async-std-native-tls', 'mysql', 'decimal' ] }
:dep serde = { version = "*", features = [ "derive" ] }
:dep dotenv
:dep rust_decimal
:dep plotly = { version = "*", features = ["kaleido"] }
:dep itertools-num
:dep rand_distr

use sqlx::{MySqlPool, FromRow};
use serde::Serialize;
use std::fs::File;
use std::io::prelude::*;
use itertools_num::linspace;
use plotly::common::{
    ColorScale, ColorScalePalette, DashType, Fill, Font, Line, LineShape, Marker, Mode, Title,
};
use plotly::layout::{Axis, BarMode, Layout, Legend, TicksDirection};
use plotly::{Bar, NamedColor, Plot, Rgb, Rgba, Scatter};
use rand_distr::{Distribution, Normal, Uniform};

Here is the code I am using:

/*
 * x_axis_data is an Vec containing 12 entries
 *    [ 9, 34082, 14212, 6881, 4176, 2661, 1862, 1326, 1001, 770, 623, 483, ]
 * y_axis_data is an Vec containing 12 entries
 *    [ 0, 0, 50000, 100000, 150000, 200000, 250000, 300000, 350000, 400000, 450000, 500000, ]
 */
let trace = Bar::new(x_axis_data, y_axis_data);
// I never get here...
let mut plot = Plot::new();
plot.add_trace(trace);
let layout = Layout::new().height(800);
plot.set_layout(layout);
plot.lab_display();

Running something similar in Python yields no problems with upwards of 50000 entries, so I have my doubts that it has anything to do with the data amounts. It seems odd that this would cause it to hang the way it has. Perhaps I am missing something? Any and all help is welcome! Thanks!

mfreeborn commented 2 years ago

I'm afraid I can't reproduce the error. Would you be able to verify if the problem persists on the most up to date versions of each of your dependencies?

mfreeborn commented 2 years ago

Happy to look again if this issue can be reproduced,