tornado.iostream.StreamClosedError: Stream is closed when using -session-ids unsigned

Context : I’ve two dashboards{Dash-1 and Dash-2}, Each dashboard has it’s browser window i.e open in two different tabs. Trying to reuse some data from dash-1 to dash-2 using bokeh session or even when user refresh same tab i want to reuse some objects which were generated in previous run . Here is what is did

  • ran Bokeh server using
    bokeh serve bokeh_app --num-procs 2 --keep-alive 1800000 --session-ids unsigned
  • accessed two dashboards using
    <HOST/bokeh_app>&dashboard=dash-1&&bokeh-session-id=foo and <HOST/bokeh_app>&dashboard=dash-2&&bokeh-session-id=foo

dash-1 loading is fine but when i access dash-2 I’m getting tornado.iostream.StreamClosedError: Stream is closed error and also unable to reuse some plots/data from dash-1 to dash -2

  File "/home/hadoop/miniconda/lib/python3.7/site-packages/tornado/gen.py", line 1141, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/hadoop/miniconda/lib/python3.7/site-packages/tornado/websocket.py", line 876, in wrapper
    raise WebSocketClosedError()
tornado.websocket.WebSocketClosedError
2020-10-11 10:58:28,116 Future exception was never retrieved
future: <Future finished exception=WebSocketClosedError()>
Traceback (most recent call last):
  File "/home/hadoop/miniconda/lib/python3.7/site-packages/tornado/websocket.py", line 874, in wrapper
    yield fut
  File "/home/hadoop/miniconda/lib/python3.7/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
tornado.iostream.StreamClosedError: Stream is closed

During handling of the above exception, another exception occurred:`

@mukeshkdangi I would not expect this to work. Individual Bokeh sessions are not really meant to be shared between browser views. Even more worrisome, HTTP arguments are only really relevant once, at session creation. I actually have no idea what passing new args to an existing session would do, but I am fairly sure it would not be anything useful. This is simply not how Bokeh is designed to be used.

If you need to share large/expensive data between different sessions, then there are a few options:

  • Use an external data base that each session connects to independently
  • Use a module-global in an external module (Python’s module caching will ensure it is only imported/executed once)