I want t run a flask site calling bokeh server that streams data from computations occur. The standalone bokeh server works great and streams data perfectly. However, when I have the same bokeh server embedded in a flask site, I get this strange error below. Can someone please take a look and advice what I can tweak or change to avoid this error?
Thanks a lot in advance.
2019-03-10 20:56:47,167 Starting Bokeh server with process id: 8905
2019-03-10 20:56:54,066 root_url should end with a /, adding one
2019-03-10 20:56:54,073 200 GET /bokeh/designData/autoload.js?bokeh-autoload-element=1000&bokeh-app-path=/bokeh/designData&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 236.03ms
2019-03-10 20:56:54,102 root_url should end with a /, adding one
2019-03-10 20:56:54,104 200 GET /bokeh/domeProfile/autoload.js?bokeh-autoload-element=1001&bokeh-app-path=/bokeh/domeProfile&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 30.60ms
2019-03-10 20:56:54,123 root_url should end with a /, adding one
2019-03-10 20:56:54,125 200 GET /bokeh/modelGen/autoload.js?bokeh-autoload-element=1004&bokeh-app-path=/bokeh/modelGen&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 20.58ms
2019-03-10 20:56:54,261 Found credentials in shared credentials file: ~/.aws/credentials
2019-03-10 20:56:54,373 root_url should end with a /, adding one
2019-03-10 20:56:54,376 200 GET /bokeh/runFEA/autoload.js?bokeh-autoload-element=1005&bokeh-app-path=/bokeh/runFEA&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 249.74ms
2019-03-10 20:56:54,400 root_url should end with a /, adding one
2019-03-10 20:56:54,402 200 GET /bokeh/matProp/autoload.js?bokeh-autoload-element=1002&bokeh-app-path=/bokeh/matProp&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 25.32ms
2019-03-10 20:56:54,416 root_url should end with a /, adding one
2019-03-10 20:56:54,419 200 GET /bokeh/windSeq/autoload.js?bokeh-autoload-element=1003&bokeh-app-path=/bokeh/windSeq&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 16.18ms
2019-03-10 20:56:54,423 root_url should end with a /, adding one
2019-03-10 20:56:54,425 200 GET /bokeh/contourPlots/autoload.js?bokeh-autoload-element=1006&bokeh-app-path=/bokeh/contourPlots&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 4.67ms
2019-03-10 20:56:54,428 root_url should end with a /, adding one
2019-03-10 20:56:54,429 200 GET /bokeh/interactModel/autoload.js?bokeh-autoload-element=1007&bokeh-app-path=/bokeh/interactModel&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 4.13ms
2019-03-10 20:56:54,432 root_url should end with a /, adding one
2019-03-10 20:56:54,434 200 GET /bokeh/viewMovie/autoload.js?bokeh-autoload-element=1008&bokeh-app-path=/bokeh/viewMovie&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 3.70ms
2019-03-10 20:56:54,616 101 GET /bokeh/designData/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.78ms
2019-03-10 20:56:54,617 WebSocket connection opened
2019-03-10 20:56:54,617 ServerConnection created
2019-03-10 20:56:54,629 101 GET /bokeh/domeProfile/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.72ms
2019-03-10 20:56:54,629 WebSocket connection opened
2019-03-10 20:56:54,630 ServerConnection created
2019-03-10 20:56:54,642 101 GET /bokeh/matProp/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.65ms
2019-03-10 20:56:54,642 WebSocket connection opened
2019-03-10 20:56:54,642 ServerConnection created
2019-03-10 20:56:54,655 101 GET /bokeh/windSeq/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.75ms
2019-03-10 20:56:54,655 WebSocket connection opened
2019-03-10 20:56:54,655 ServerConnection created
2019-03-10 20:56:54,670 101 GET /bokeh/modelGen/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.70ms
2019-03-10 20:56:54,671 WebSocket connection opened
2019-03-10 20:56:54,671 ServerConnection created
2019-03-10 20:56:54,692 101 GET /bokeh/runFEA/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.58ms
2019-03-10 20:56:54,693 WebSocket connection opened
2019-03-10 20:56:54,693 ServerConnection created
2019-03-10 20:56:54,707 101 GET /bokeh/contourPlots/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.61ms
2019-03-10 20:56:54,708 WebSocket connection opened
2019-03-10 20:56:54,708 ServerConnection created
2019-03-10 20:56:54,719 101 GET /bokeh/interactModel/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.47ms
2019-03-10 20:56:54,719 WebSocket connection opened
2019-03-10 20:56:54,720 ServerConnection created
2019-03-10 20:56:54,732 101 GET /bokeh/viewMovie/ws?bokeh-protocol-version=1.0&bokeh-session-id=Pe0oVVUUwIfunzmfvC13qRbxEAYBSf8cf1GDN40ajQ3e-EA7Ye4tzUZS7hdLtaYEET4LIBStbhIR16kfN1n-IAd8 (34.212.125.218) 0.50ms
2019-03-10 20:56:54,732 WebSocket connection opened
2019-03-10 20:56:54,732 ServerConnection created
2019-03-10 20:58:07,307 Failed sending message as connection was closed
2019-03-10 20:58:07,309 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,310 Exception in callback <bound method BokehTornado._keep_alive of <bokeh.server.tornado.BokehTornado object at 0x7f0e2e7d3438>>
Traceback (most recent call last):
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/tornado/ioloop.py”, line 1229, in _run
return self.callback()
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/bokeh/server/tornado.py”, line 514, in _keep_alive
c.send_ping()
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/bokeh/server/connection.py”, line 46, in send_ping
self._socket.ping(codecs.encode(str(self._ping_count), “utf-8”))
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/tornado/websocket.py”, line 367, in ping
self.ws_connection.write_ping(data)
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/tornado/websocket.py”, line 882, in write_ping
self._write_frame(True, 0x9, data)
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/tornado/websocket.py”, line 846, in _write_frame
return self.stream.write(frame)
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/tornado/iostream.py”, line 570, in write
self._check_closed()
File “/home/ubuntu/.virtualenvs/cpvdesign_env/lib/python3.6/site-packages/tornado/iostream.py”, line 1112, in _check_closed
raise StreamClosedError(real_error=self.error)
tornado.iostream.StreamClosedError: Stream is closed
2019-03-10 20:58:07,316 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,317 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,318 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,318 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,319 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,320 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,320 WebSocket connection closed: code=None, reason=None
2019-03-10 20:58:07,320 WebSocket connection closed: code=None, reason=None
``