Hi there,
Today I have encountered a behaviour of the bokeh server which I have not seen before, and I hope the clever community here can help me solve. I should begin by saying that this doesn’t strike me as a bug in bokeh, but perhaps a bug in how I am handling the server.
I am working on a fairly small web app (some text, six or so plots, a small datatable, and an image embedded in a div tag, all split up over a few tab panels). I’m working in python 2.7, using bokeh 0.12.4, and have been running this app, in gradually increasing stages of completeness, for several months now.
I don’t claim that it’s very fast or optimised - in fact, I’m certain that it’s not! However, I don’t require ultra-fast operation, so this is usually fine. Today, though, things are very slow!
I launch my app using the following quite standard command line format, which has worked fine in the past.
bokeh serve scriptname.py --port XXXX --host XXX.X.X.X:XX --host domain_name:XX
When I open a connection to the server, my page appears in the browser, with all elements present and correct, in a reasonable amount of time. However, it is not responsive for up to several minutes after this. When I click on a button, for example, nothing happens at once; instead, I wait a few minutes, and then I see the button callback execute as expected (both in the browser, and at the command-line log).
Some things to note:
- If several button clicks are made during this hang-time, they all execute one after the other.
- Once the intial hang is complete, my interactions work exactly as expected, and everything executes in real time, with no problems.
- I am able to push from the server to the client during this hang time, just not the other way around. For example, I have a ‘start’ button for the app, which I have set up so that it is disabled when the document first loads (to encourage the user to read some introductory text). Then, I use a periodic callback to re-enable this button once X seconds have elapsed after the server connection was made. This periodic callback does execute during the hang time, and I can see the button change from disabled to enabled. However, if I click the re-enabled button (or any other button), the callback may not execute for another five minutes!
I tried using chrome’s dev tools to diagnose what is going on in this hang time, and I attach some screenshots. I am not a web developer, and this is my first experience in using these tools, so any advice is welcome!!
However, what naively sticks out to me is the websocket, which I have highlighted in the screenshots. It always says ‘Connection Start: Stalled’, with a time (shown here) of 5.7 minutes. I have seen this value go up to 8 minutes! This ‘stalled’ time seems to correspond to the length of time that my page stays hung before it becomes responsive.
Can anyone advise whether a ‘Stalled’ websocket status would cause the behaviour I’m seeing? And if so, how to resolve it? Any advice would be gratefully appreciated.
In case it’s relevant, I should note: I attempted to update to bokeh 0.12.6 last night, but found that I couldn’t run my server as normal (unfortunately, I did not copy down the error I encountered, but it had to do with a missing or incorrect websocket_url). So, I reverted to 0.12.4.
I apologise if this is rather unclear, or tangential to the core functionality of bokeh; however, any advice would be greatly appreciated!
Thanks,
Sarah