bokeh: Exceptions when updating plots in new example

I created a pretty cool application with bokeh, which shows functionality that is not yet covered by any existing example. The code is attached to this issue and can freely be used as an official example. In the code custom barplots (not charts) for year, month, daily and named data were created. Tapping on a year will trigger a server side select of a month and refreshes the month plot data. The month plot then at the same time selects a day and refreshes the daily data and so on.

You should give it a try it is very cool.

Download and unpack bars_example.zip

Start the bokeh server (iam using bokeh 0.11.1):

bokeh serve

run the example with:

python bars_example.py

Try selecting a year/month/day and see how everything is adapting x_range, y_range, secondary y_range. Also a mechanism was implemented to make it impossible to not have selected any bar. (Try clicking on the white space next to a bar).

The example was created with the goal to be able to continuously add more data and have the barplots adapt accordingly live. E.g. adding data from year 2017 will create the bar 2017 and directly show it if it does not exist yet.

A secondary mode was created which continuously adds days, which will create new month and even years. If new data was created it is directly selected and displayed. You can execute this mode by:

python bars_example.py --follow

The mode works pretty well but if you wait a few minutes the following exception will appear. I tried it on multiple machines … if you wait long enough the exception always appears.

Sometimes no exception appears and cpu usage by bokeh server is 100% and firefox and chrome usage also goes to 100%, while the plots stop updating.

The Exception that shows up is:

ERROR:bokeh.server.protocol.server_handler:error handling message Message 'PATCH-DOC' (revision 1): KeyError('references',)
DEBUG:bokeh.server.protocol.server_handler:  message header {u'msgid': u'718900fc-f196-4b36-84b9-f1ee7a3654bc', u'msgtype': u'PATCH-DOC'} content {}
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/bokeh/server/protocol/server_handler.py", line 38, in handle
    work = yield handler(message, connection)
  File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1017, in run
    yielded = self.gen.send(value)
  File "/usr/local/lib/python2.7/dist-packages/bokeh/server/session.py", line 42, in _needs_document_lock_wrapper
    result = yield yield_for_all_futures(func(self, *args, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/bokeh/server/session.py", line 212, in _handle_patch
    message.apply_to_document(self.document)
  File "/usr/local/lib/python2.7/dist-packages/bokeh/server/protocol/messages/patch_doc.py", line 85, in apply_to_document
    doc.apply_json_patch(self.content)
  File "/usr/local/lib/python2.7/dist-packages/bokeh/document.py", line 836, in apply_json_patch
    references_json = patch['references']
KeyError: 'references'

And sometimes directly after starting the program:

ERROR:bokeh.server.views.ws:Bokeh Server protocol error: No 'msgtype'

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 32 (10 by maintainers)

Most upvoted comments