Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bokeh raises Token is Expired exception #231

Open
henrykotze opened this issue Mar 15, 2022 · 5 comments
Open

Bokeh raises Token is Expired exception #231

henrykotze opened this issue Mar 15, 2022 · 5 comments

Comments

@henrykotze
Copy link

For logs which are large, and takes time to fully load the webapp results in Bokeh throwing "Token is expired" exception. This occurs when I run the webapp locally and launch it using the ./serve -f /path/to/ulog.ulg

The console output is the following:

ERROR:tornado.application:Uncaught exception GET /plot_app/ws?log=/home/$USER/Desktop/2022-03-04/05_57_54.ulg (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:5006', method='GET', uri='/plot_app/ws?log=/home/$USER//Desktop/2022-03-04/05_57_54.ulg', version='HTTP/1.1', remote_ip='127.0.0.1')
Traceback (most recent call last):
  File "/home/$USER//.local/lib/python3.8/site-packages/tornado/websocket.py", line 954, in _accept_connection
    open_result = handler.open(*handler.open_args, **handler.open_kwargs)
  File "/home/$USER//.local/lib/python3.8/site-packages/tornado/web.py", line 3173, in wrapper
    return method(self, *args, **kwargs)
  File "/home/$USER//.local/lib/python3.8/site-packages/bokeh/server/views/ws.py", line 149, in open
    raise ProtocolError("Token is expired.")
bokeh.protocol.exceptions.ProtocolError: Token is expired.
WARNING:tornado.access:404 GET /favicon.ico (127.0.0.1) 0.88ms

The program than just waits here indefinitely with the web application waiting on "Loading Plots"

@bkueng
Copy link
Member

bkueng commented Mar 16, 2022

Can you check if there's a timeout we can increase?

@henrykotze
Copy link
Author

Here are relevant links which help me solved the issue:
bokeh-server-2-0-0-session-expiration-duration
slow-response-protocol-exceptions-protocol-error-token-is-expired

I had to increase the DEFAULT_SESSION_TOKEN_EXPIRATION global variable which is used for the parameter session_token_expiration in the BokehTornado object. BokehTornado. Thus I increased the global variable in the bokeh/server/tornado.py file in my local user path.

I dont see a way how to increase this parameter from flight review without extending bokeh to provide access to this variable from the bokeh.server.server object (Server)which is called from the serve.py file.

@bkueng
Copy link
Member

bkueng commented Mar 18, 2022

It looks like you can just pass it in:

diff --git a/app/serve.py b/app/serve.py
index 0abc47f..6e8293d 100755
--- a/app/serve.py
+++ b/app/serve.py
@@ -95,6 +95,7 @@ server_kwargs['websocket_max_message_size'] = 100 * 1024 * 1024

 # increase the maximum upload size (default is 100MB)
 server_kwargs['http_server_kwargs'] = {'max_buffer_size': 300 * 1024 * 1024}
+server_kwargs['session_token_expiration'] = 300


 show_ulog_file = False

@henrykotze
Copy link
Author

Interesting, I thought I tried that, and it didn't work. Will inspect and report.

@bkueng
Copy link
Member

bkueng commented Jun 19, 2023

Did it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants