holoviz / datashader

Quickly and accurately render even the largest data.
http://datashader.org
BSD 3-Clause "New" or "Revised" License
3.32k stars 365 forks source link

Dead kernel in 3_Interactive.ipynb #976

Closed jbednar closed 3 years ago

jbednar commented 3 years ago

As originally reported in https://github.com/holoviz/datashader/pull/939, the notebook getting_started/3_Interactive.ipynb sometimes fails to execute using either current Datashader master or the 0.11.1 release, reporting that the kernel has died. I have not yet been able to reduce it to a minimal example, but here's at least a cut-down one. First, create segfault.ipynb, containing:

import pandas as pd, numpy as np, holoviews as hv
import holoviews.operation.datashader as hd
from holoviews.streams import RangeXY
hv.extension("bokeh", "matplotlib") 

num=100000
np.random.seed(1)

dists = {cat: pd.DataFrame(dict([('x',np.random.normal(x,s,num)), 
                                 ('y',np.random.normal(y,s,num)), 
                                 ('val',val), 
                                 ('cat',cat)]))      
         for x,  y,  s,  val, cat in 
         [(  2,  2, 0.03, 10, "d1"), 
          (  2, -2, 0.10, 20, "d2"), 
          ( -2, -2, 0.50, 30, "d3"), 
          ( -2,  2, 1.00, 40, "d4"), 
          (  0,  0, 3.00, 50, "d5")] }

df = pd.concat(dists,ignore_index=True)
df["cat"]=df["cat"].astype("category")

points = hv.Points(df.sample(10000))

pts = hd.datashade(points, width=400, height=400)

quadmesh =  hv.QuadMesh(hd.aggregate(points, width=10, height=10, dynamic=False)) \
            .opts(tools=['hover'], alpha=0, hover_alpha=0.2)

dynamic = hv.util.Dynamic(hd.aggregate(points, width=10, height=10, streams=[RangeXY]), 
                          operation=hv.QuadMesh) \
          .opts(tools=['hover'], alpha=0, hover_alpha=0.2)

(pts * quadmesh).relabel("Fixed hover") + (pts * dynamic).relabel("Dynamic hover")

Second, create segfault.py, containing:

from nbconvert.preprocessors import ExecutePreprocessor
import nbformat
import io

for i in range(100):
    print(i)
    nb = io.open('./segfault.ipynb', encoding='utf-8')
    notebook = nbformat.read(nb, as_version=4)
    ep = ExecutePreprocessor(allow_errors=False)
    output = ep.preprocess(notebook, {})

The original error was found in CI on Ubuntu, but when I run this on my Mac OS X laptop, I get something like:

$ python segfault.py
0
1
python(47650,0x11104adc0) malloc: Incorrect checksum for freed object 0x7ffcae5225a8: probably modified after being freed.
Corrupt value: 0x10000800cae519e2
python(47650,0x11104adc0) malloc: *** set a breakpoint in malloc_error_break to debug
2
3
4
Traceback (most recent call last):
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbclient/client.py", line 816, in async_execute_cell
    exec_reply = await self.task_poll_for_reply
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
concurrent.futures._base.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "segfault.py", line 10, in <module>
    output = ep.preprocess(notebook, {})
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbconvert/preprocessors/execute.py", line 79, in preprocess
    self.execute()
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/asyncio/tasks.py", line 180, in _step
    result = coro.send(None)
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbclient/client.py", line 541, in async_execute
    cell, index, execution_count=self.code_cells_executed + 1
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbconvert/preprocessors/execute.py", line 123, in async_execute_cell
    cell, resources = self.preprocess_cell(cell, self.resources, cell_index)
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbconvert/preprocessors/execute.py", line 146, in preprocess_cell
    cell = run_sync(NotebookClient.async_execute_cell)(self, cell, index, store_history=self.store_history)
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/asyncio/tasks.py", line 182, in _step
    result = coro.throw(exc)
  File "/Users/jbednar/miniconda3/envs/holoviz/lib/python3.6/site-packages/nbclient/client.py", line 820, in async_execute_cell
    raise DeadKernelError("Kernel died")
nbclient.exceptions.DeadKernelError: Kernel died
35.596u 3.990s 0:44.58 88.7%    0+0k 0+0io 3pf+0w

I can also reproduce it interactively within Jupyter, by doing Restart and Run All, but sometimes it takes 10 or 20 tries to see any problem; usually it just nicely creates two Bokeh-based Datashader plots.

The messages suggest that memory might be being modified after it was freed, which sounds consistent with this behavior (in that if the memory isn't yet being used for anything there's no harm in doing so). The issues may be Numba related, as so far I have not seen them when I do env NUMBA_DISABLE_JIT=1 python segfault.py, but that's not conclusive, as I also don't happen to have seen them when I take "matplotlib" out of the hv.extension() call, which seems entirely unrelated to anything Numba is doing.

jbednar commented 3 years ago

I was able to reproduce the issue in a fresh environment created with conda create -c pyviz -n segfault holoviews bokeh matplotlib pandas datashader notebook:

$ python segfault.py 
0
1
2
3
4
5
6
7
python(50040,0x112519dc0) malloc: tiny_free_list_remove_ptr: Internal invariant broken (next ptr of prev): ptr=0x7faf53bb10d0, prev_next=0x7fbf53bb10d0
python(50040,0x112519dc0) malloc: *** set a breakpoint in malloc_error_break to debug
8
9
10
11
12
13
14
15
Traceback (most recent call last):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/client.py", line 816, in async_execute_cell
    exec_reply = await self.task_poll_for_reply
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 260, in __await__
    yield self  # This tells Task to wait for completion.
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/tasks.py", line 349, in __wakeup
    future.result()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 173, in result
    raise exceptions.CancelledError
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "segfault.py", line 10, in <module>
    output = ep.preprocess(notebook, {})
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 79, in preprocess
    self.execute()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 178, in result
    raise self._exception
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/tasks.py", line 280, in __step
    result = coro.send(None)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/client.py", line 540, in async_execute
    await self.async_execute_cell(
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 123, in async_execute_cell
    cell, resources = self.preprocess_cell(cell, self.resources, cell_index)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 146, in preprocess_cell
    cell = run_sync(NotebookClient.async_execute_cell)(self, cell, index, store_history=self.store_history)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 178, in result
    raise self._exception
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/tasks.py", line 282, in __step
    result = coro.throw(exc)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/client.py", line 820, in async_execute_cell
    raise DeadKernelError("Kernel died")
nbclient.exceptions.DeadKernelError: Kernel died
jbednar commented 3 years ago

If I add import faulthandler; faulthandler.enable() to the notebook, the output is:

python segfault.py
0
python(50640,0x1062f5dc0) malloc: tiny_free_list_remove_ptr: Internal invariant broken (next ptr of prev): ptr=0x7fc0db030430, prev_next=0x7fd0db030430
python(50640,0x1062f5dc0) malloc: *** set a breakpoint in malloc_error_break to debug
Fatal Python error: Aborted

Thread 0x0000700006dba000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/parentpoller.py", line 39 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x00000001062f5dc0 (most recent call first):
<no Python frame>
1
Fatal Python error: Segmentation fault

Thread 0x000070000bfd6000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/parentpoller.py", line 39 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x000070000ae4a000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/heartbeat.py", line 100 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x0000700009e47000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/selectors.py", line 558 in select
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/base_events.py", line 1823 in _run_once
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/base_events.py", line 570 in run_forever
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 199 in start
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/iostream.py", line 78 in _thread_main
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 870 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x000000011a860dc0 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/displayhook.py", line 311 in flush
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 1431 in reset
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3783 in atexit_operations
2
python(50698,0x10ddebdc0) malloc: tiny_free_list_remove_ptr: Internal invariant broken (next ptr of prev): ptr=0x7fce208657e0, prev_next=0x7fde208657e0
python(50698,0x10ddebdc0) malloc: *** set a breakpoint in malloc_error_break to debug
Fatal Python error: Aborted

Thread 0x000070000885c000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/zmq/utils/garbage.py", line 47 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x0000700007859000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/parentpoller.py", line 39 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007000066cd000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/heartbeat.py", line 100 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007000056ca000 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/selectors.py", line 558 in select
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/base_events.py", line 1823 in _run_once
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/base_events.py", line 570 in run_forever
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 199 in start
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/iostream.py", line 78 in _thread_main
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 870 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x000000010ddebdc0 (most recent call first):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/operation.py", line 141 in _apply
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/operation.py", line 194 in process_element
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 993 in _process
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1011 in apply
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1019 in dynamic_operation
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 714 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1100 in _execute_callback
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1331 in __getitem__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1007 in resolve
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1018 in dynamic_operation
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 683 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1100 in _execute_callback
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1331 in __getitem__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1007 in resolve
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1018 in dynamic_operation
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 683 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1100 in _execute_callback
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1331 in __getitem__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 215 in dynamic_mul
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 683 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1100 in _execute_callback
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1331 in __getitem__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1007 in resolve
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1018 in dynamic_operation
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 683 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1100 in _execute_callback
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1331 in __getitem__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1007 in resolve
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/util/__init__.py", line 1018 in dynamic_operation
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 683 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1100 in _execute_callback
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/spaces.py", line 1331 in __getitem__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/util.py", line 275 in get_plot_frame
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/plot.py", line 1272 in _get_frame
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/bokeh/element.py", line 2376 in update_frame
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/plot.py", line 446 in __getitem__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/plot.py", line 981 in update
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/plot.py", line 257 in _trigger_refresh
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/plot.py", line 240 in refresh
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/streams.py", line 171 in trigger
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/renderer.py", line 257 in get_plot
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/bokeh/renderer.py", line 73 in get_plot
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/panel/pane/holoviews.py", line 306 in _render
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/panel/pane/holoviews.py", line 241 in _get_model
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/panel/layout/base.py", line 102 in _get_objects
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/panel/layout/base.py", line 112 in _get_model
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/panel/viewable.py", line 482 in get_root
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/panel/viewable.py", line 424 in _render_model
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/plotting/renderer.py", line 410 in components
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 68 in render
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 220 in layout_display
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 146 in wrapped
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 255 in display
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 282 in pprint_display
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/options.py", line 1405 in render
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/holoviews/core/dimension.py", line 1316 in _repr_mimebundle_
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/formatters.py", line 970 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/formatters.py", line 224 in catch_format_error
  File "<decorator-gen-5>", line 2 in __call__
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/formatters.py", line 150 in format
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/displayhook.py", line 151 in compute_format_data
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/displayhook.py", line 262 in __call__
  File "<ipython-input-1-923c236f8f6b>", line 36 in <module>
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3418 in run_code
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3338 in run_ast_nodes
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3146 in run_cell_async
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68 in _pseudo_sync_runner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2923 in _run_cell
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2877 in run_cell
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/zmqshell.py", line 536 in run_cell
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 306 in do_execute
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/gen.py", line 234 in wrapper
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 543 in execute_request
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/gen.py", line 234 in wrapper
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 268 in dispatch_shell
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/gen.py", line 234 in wrapper
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 365 in process_one
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/gen.py", line 775 in run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/gen.py", line 814 in inner
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/ioloop.py", line 741 in _run_callback
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/ioloop.py", line 688 in <lambda>
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/events.py", line 81 in _run
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/base_events.py", line 1859 in _run_once
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/base_events.py", line 570 in run_forever
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 199 in start
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 612 in start
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/traitlets/config/application.py", line 845 in launch_instance
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/ipykernel_launcher.py", line 16 in <module>
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/runpy.py", line 87 in _run_code
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/runpy.py", line 194 in _run_module_as_main
Traceback (most recent call last):
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/client.py", line 816, in async_execute_cell
    exec_reply = await self.task_poll_for_reply
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 260, in __await__
    yield self  # This tells Task to wait for completion.
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/tasks.py", line 349, in __wakeup
    future.result()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 173, in result
    raise exceptions.CancelledError
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "segfault.py", line 10, in <module>
    output = ep.preprocess(notebook, {})
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 79, in preprocess
    self.execute()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 178, in result
    raise self._exception
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/tasks.py", line 280, in __step
    result = coro.send(None)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/client.py", line 540, in async_execute
    await self.async_execute_cell(
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 123, in async_execute_cell
    cell, resources = self.preprocess_cell(cell, self.resources, cell_index)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 146, in preprocess_cell
    cell = run_sync(NotebookClient.async_execute_cell)(self, cell, index, store_history=self.store_history)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 74, in wrapped
    return just_run(coro(*args, **kwargs))
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/util.py", line 53, in just_run
    return loop.run_until_complete(coro)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nest_asyncio.py", line 98, in run_until_complete
    return f.result()
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/futures.py", line 178, in result
    raise self._exception
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/asyncio/tasks.py", line 282, in __step
    result = coro.throw(exc)
  File "/Users/jbednar/miniconda3/envs/segfault/lib/python3.8/site-packages/nbclient/client.py", line 820, in async_execute_cell
    raise DeadKernelError("Kernel died")
nbclient.exceptions.DeadKernelError: Kernel died
16.548u 1.790s 0:22.53 81.3%    0+0k 0+0io 0pf+0w
stuartarchibald commented 3 years ago

Suspect this is out of bounds memory accesses causing corruption. Updating the script to:

import os
os.environ["NUMBA_BOUNDSCHECK"] = "1" # do bounds checking
os.environ["NUMBA_FULL_TRACEBACKS"] = "1" # dump bounds check info to the terminal (not jupyter terminal but the shell that launched jupyter, the info is printed via `fprintf`)
import pandas as pd, numpy as np, holoviews as hv
import holoviews.operation.datashader as hd
from holoviews.streams import RangeXY
hv.extension("bokeh", "matplotlib") 

num=100000
np.random.seed(1)

dists = {cat: pd.DataFrame(dict([('x',np.random.normal(x,s,num)), 
                                 ('y',np.random.normal(y,s,num)), 
                                 ('val',val), 
                                 ('cat',cat)]))      
         for x,  y,  s,  val, cat in 
         [(  2,  2, 0.03, 10, "d1"), 
          (  2, -2, 0.10, 20, "d2"), 
          ( -2, -2, 0.50, 30, "d3"), 
          ( -2,  2, 1.00, 40, "d4"), 
          (  0,  0, 3.00, 50, "d5")] }

df = pd.concat(dists,ignore_index=True)
df["cat"]=df["cat"].astype("category")

points = hv.Points(df.sample(10000))

pts = hd.datashade(points, width=400, height=400)

quadmesh =  hv.QuadMesh(hd.aggregate(points, width=10, height=10, dynamic=False)) \
            .opts(tools=['hover'], alpha=0, hover_alpha=0.2)

dynamic = hv.util.Dynamic(hd.aggregate(points, width=10, height=10, streams=[RangeXY]), 
                          operation=hv.QuadMesh) \
          .opts(tools=['hover'], alpha=0, hover_alpha=0.2)

(pts * quadmesh).relabel("Fixed hover") + (pts * dynamic).relabel("Dynamic hover")

gives me:

lib/python3.8/site-packages/datashader/glyphs/points.py", line 194, in extend
    do_extend(
IndexError: index is out of bounds

and the terminal reports:

debug: IndexError: index 10 is out of bounds for axis 0 with size 10

I'd probably elect to fix this first and then see if that sorts out the corruption, if it doesn't, will take another look. Hope this helps?

nvictus commented 3 years ago

I'm able to trigger the segfault without "matplotlib" in hv.extension() at all. It seems to depend on whether the dynamic plot gets rendered.

Here's a more minimal notebook:

import faulthandler; faulthandler.enable()

import pandas as pd, numpy as np, holoviews as hv
import holoviews.operation.datashader as hd
from holoviews.streams import RangeXY

hv.extension("bokeh") 

num = 100000
np.random.seed(1)

dists = {cat: pd.DataFrame(dict([('x',np.random.normal(x,s,num)), 
                                 ('y',np.random.normal(y,s,num)), 
                                 ('val',val), 
                                 ('cat',cat)]))      
         for x,  y,  s,  val, cat in 
         [(  2,  2, 0.03, 10, "d1"), 
          (  2, -2, 0.10, 20, "d2"), 
          ( -2, -2, 0.50, 30, "d3"), 
          ( -2,  2, 1.00, 40, "d4"), 
          (  0,  0, 3.00, 50, "d5")] }
df = pd.concat(dists,ignore_index=True)
df["cat"]=df["cat"].astype("category")

points = hv.Points(df.sample(10000))

hv.util.Dynamic(
    hd.aggregate(points, width=10, height=10, streams=[RangeXY]), 
    operation=hv.QuadMesh
).opts(tools=['hover'], alpha=0, hover_alpha=0.2)
0
1
2
double free or corruption (out)
Fatal Python error: Aborted

Thread 0x00007f3e11ffb700 (most recent call first):
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/parentpoller.py", line 39 in run
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x00007f3e1d587740 (most recent call first):
<no Python frame>
3
4
5
6
Fatal Python error: Segmentation fault

Thread 0x00007fd85a4a3700 (most recent call first):
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/zmq/utils/garbage.py", line 47 in run
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007fd895ed2700 (most recent call first):
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/parentpoller.py", line 39 in run
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007fd897755700 (most recent call first):
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/heartbeat.py", line 100 in run
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 890 in _bootstrap

Thread 0x00007fd897f56700 (most recent call first):
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/selectors.py", line 468 in select
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/asyncio/base_events.py", line 1823 in _run_once
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/asyncio/base_events.py", line 570 in run_forever
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 199 in start
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/iostream.py", line 78 in _thread_main
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 870 in run
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 932 in _bootstrap_inner
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/threading.py", line 890 in _bootstrap

Current thread 0x00007fd89d31e740 (most recent call first):
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/base64.py", line 58 in b64encode
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/util/serialization.py", line 549 in encode_base64_dict
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/util/serialization.py", line 418 in serialize_array
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/util/serialization.py", line 327 in transform_array
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/util/serialization.py", line 483 in transform_column_source_data
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/core/property/container.py", line 255 in serialize_value
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/core/property/descriptors.py", line 290 in serializable_value
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/core/has_props.py", line 562 in query_properties_with_values
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/core/has_props.py", line 515 in properties_with_values
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/model.py", line 716 in _to_json_like
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/document/util.py", line 136 in references_json
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/document/document.py", line 925 in to_json_string
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/document/document.py", line 901 in to_json
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/bokeh/embed/util.py", line 294 in standalone_docs_json_and_render_items
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/panel/io/notebook.py", line 139 in render_model
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/panel/io/notebook.py", line 173 in render_mimebundle
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/plotting/renderer.py", line 425 in components
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 68 in render
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 206 in map_display
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 146 in wrapped
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 258 in display
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/ipython/display_hooks.py", line 282 in pprint_display
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/core/options.py", line 1405 in render
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/holoviews/core/dimension.py", line 1316 in _repr_mimebundle_
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/formatters.py", line 970 in __call__
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/formatters.py", line 224 in catch_format_error
  File "<decorator-gen-5>", line 2 in __call__
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/formatters.py", line 150 in format
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/displayhook.py", line 151 in compute_format_data
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/displayhook.py", line 262 in __call__
  File "<ipython-input-1-ed3b7b4b4bdd>", line 27 in <module>
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3418 in run_code
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3338 in run_ast_nodes
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3146 in run_cell_async
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/async_helpers.py", line 68 in _pseudo_sync_runner
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2923 in _run_cell
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 2877 in run_cell
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/zmqshell.py", line 536 in run_cell
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/ipkernel.py", line 306 in do_execute
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/gen.py", line 234 in wrapper
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 543 in execute_request
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/gen.py", line 234 in wrapper
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 268 in dispatch_shell
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/gen.py", line 234 in wrapper
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/kernelbase.py", line 365 in process_one
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/gen.py", line 775 in run
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/gen.py", line 814 in inner
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/ioloop.py", line 741 in _run_callback
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/ioloop.py", line 688 in <lambda>
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/asyncio/events.py", line 81 in _run
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/asyncio/base_events.py", line 1859 in _run_once
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/asyncio/base_events.py", line 570 in run_forever
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/tornado/platform/asyncio.py", line 199 in start
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel/kernelapp.py", line 612 in start
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/traitlets/config/application.py", line 845 in launch_instance
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/ipykernel_launcher.py", line 16 in <module>
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/runpy.py", line 87 in _run_code
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/runpy.py", line 194 in _run_module_as_main
Traceback (most recent call last):
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 478, in _poll_for_reply
    msg = self.kc.shell_channel.get_msg(timeout=timeout)
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/jupyter_client/blocking/channels.py", line 54, in get_msg
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "segfault.py", line 10, in <module>
    output = ep.preprocess(notebook, {})
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 405, in preprocess
    nb, resources = super(ExecutePreprocessor, self).preprocess(nb, resources)
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/nbconvert/preprocessors/base.py", line 69, in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 438, in preprocess_cell
    reply, outputs = self.run_cell(cell, cell_index, store_history)
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 578, in run_cell
    exec_reply = self._poll_for_reply(parent_msg_id, cell, timeout)
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 483, in _poll_for_reply
    self._check_alive()
  File "/home/nezar/miniconda3/envs/sp20-test/lib/python3.8/site-packages/nbconvert/preprocessors/execute.py", line 510, in _check_alive
    raise DeadKernelError("Kernel died")
nbconvert.preprocessors.execute.DeadKernelError: Kernel died

And I get the same index error on every iteration when I set the environment variables @stuartarchibald posted above.

0
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
1
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
2
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
3
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
4
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
5
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
6
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
7
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
8
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
9
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
10
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
11
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
12
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
13
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
14
debug: IndexError: index 10 is out of bounds for axis 0 with size 10
15
jbednar commented 3 years ago

I can't get my head around this. The two lines where the problem is raised :

  File "/Users/jbednar/datashader/datashader/data_libraries/pandas.py", line 45, in default
    extend(bases, source, x_st + y_st, x_range + y_range)
  File "/Users/jbednar/datashader/datashader/glyphs/points.py", line 195, in extend
    sx, tx, sy, ty, xmin, xmax, ymin, ymax, xs, ys, *aggs_and_cols

are both very old, not having been changed since October 2019 (#794), and similarly for the code immediately around them. Yet those do seem like the functions where these data ranges are calculated and thus could have incorrect sizes. I see the same problems for Datashader 0.9.0 and 0.10.0, so I can't tell why we haven't always been having problems like this.

Also, I can only get the problem to trigger for width=height=10 or less; larger arrays maybe don't have rounding issues in the same way?

Still seems very mysterious.