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

websocket server do not send a ping frame to client, make websocket frequently lost connection throught a reverse proxy like nginx #458

Closed
franckchen opened this issue Jan 7, 2021 · 1 comment · Fixed by #459

Comments

@franckchen
Copy link

Description

Hi~:
Notebook websocket will send ping frame periodically, by default the interval is 30 sec.
https://github.com/jupyter/notebook/blob/1550410229e302ecf74d5bf82d5caba6e6296a64/notebook/base/zmqhandlers.py#L162

but lsp websocket will not. bcz the handler override the open method.
https://github.com/krassowski/jupyterlab-lsp/blob/c9ba03bd85cef7b8f923099205bf7b0d958f3892/python_packages/jupyter_lsp/jupyter_lsp/handlers.py#L25

From my view. I think it's very necessary to send a ping frame periodically.bcz in production environment,the request are ofen forwarded through a reverse proxy like nginx, and alway nginx is set with a read timeout rule.If there is no ping frame, the websocket connection may not transmit any data for a long time, and then trigger ngnix timeout rule, the ws connection will be force closed by nginx.

From nginx document:

By default, the connection will be closed if the proxied server does not transmit any data within 60 seconds. This timeout can be increased with the proxy_read_timeout directive. Alternatively, the proxied server can be configured to periodically send WebSocket ping frames to reset the timeout and check if the connection is still alive.

the recommendation is the set websocket server to periodically send WebSocket ping frames~

so how about read the notebook configuration and send the ping frame?

Reproduce

use jupyterlab-lsp with nginx together

Expected behavior

websocket server read the notebook configuration and send the ping frame like notebook websokcet handler

Context

  • Operating System and version: any
  • Browser and version: any
  • JupyterLab version: any
Required: installed server extensions
Required: installed lab extensions
Troubleshoot Output
Command Line Output
Browser Output (recommended for all interface issues)

@krassowski
Copy link
Member

Indeed, thank you! Calling super().open to trigger WebSocketMixin.open would probably suffice.

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

Successfully merging a pull request may close this issue.

2 participants