question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connection errors when sending large amounts of data to browser via a bokeh server

See original GitHub issue

Recently I came across a problem with sending lots of data to a bokeh server, between 20 - 50 MB. The command I used was

bokeh serve data_visualisation --show --args -i path_to_large_file

What would happen is that my plot would render, and then almost instantly a timeout would occur so no communication between the browser and server was possible:

2018-01-05 10:19:58,280 200 GET /data_visualisation (::1) 9227.38ms
2018-01-05 10:19:58,455 101 GET /data_visualisation/ws?bokeh-protocol-version=1.0&bokeh-session-id=jbQmzoBZbYDBDUdi5Ix6QShbAJtAMGPhmKvC1SWjOuwA (::1) 0.87ms
2018-01-05 10:19:58,455 WebSocket connection opened
2018-01-05 10:19:58,456 ServerConnection created
2018-01-05 10:21:28,512 WebSocket connection closed: code=None, reason=None

In the browser console, the following errors where shown:

[bokeh] Lost websocket 0 connection, 1006 ()  connection.js:221
[bokeh] Websocket connection 0 disconnected, will not attempt to reconnect connection.js:105 

The problem was solved by editing tornado.py by changing the rule on line 221 super(BokehTornado, self).__init__(all_patterns) to super(BokehTornado, self).__init__(all_patterns, websocket_max_message_size=50 * 1024 * 1024)

By default, the maximum socket message size is 10MiB for the used version of Tornado, and would disconnect for this reason. A more meaningful error message or the possibility to change this value in bokeh would be appreciated.

Software version info

bokeh==0.12.13 Tornado==4.5.2 python==3.6.3 MacOS High Sierra (10.13.2) Any browser (Chrome (63.0.3239.84) / Safari / Firefox)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
bryevdvcommented, Jun 4, 2018

I’m working on a PR for this right now.

2reactions
bryevdvcommented, Jan 5, 2018

@Belloco unfortunately it is not possible to provide a better error message. Those messages originate from the browser, and Tornado respectively, not Bokeh. Bokeh only sees that the connection is closed, it does not get any information about why it was closed.

However, if it is possible to expose websocket_max_message_size as a user configurable option that that’s certainly reasonable. However it is not completely trivial, as that option appears to be new to Tornado 4.5 and Bokeh support tornado >=4.4 so there will have to be some kind of version handling. Are you interested in helping work up a PR for this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bokeh throwing strange errors in browser console - Panel
Connection errors when sending large amounts of data to browser via a bokeh server. opened 09:37AM - 05 Jan 18 UTC.
Read more >
Passing websocket_max_message_size when embedding ...
When bokeh server is embedded in a notebook (like here ... in this issue: Connection errors when sending large amounts of data to...
Read more >
Running a Bokeh Server — Bokeh 2.2.2 Documentation
This capability to synchronize between Python and the browser is the main purpose of the Bokeh Server. The simple example below, embedded from...
Read more >
Running a Bokeh server
The primary purpose of the Bokeh server is to synchronize data between the underlying Python environment and the BokehJS library running in the...
Read more >
Understanding Bokeh server — Bokeh 3.0.3 Documentation
The server has a websocket connection open to each client (each browser tab, in typical usage). · There are two client implementations in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found