jupyterlab / jupyter-collaboration

A Jupyter Server Extension Providing Support for Y Documents
https://jupyterlab-realtime-collaboration.readthedocs.io/en/latest/
Other
168 stars 31 forks source link

Connection lost after (about) one minute #366

Closed imerelli closed 1 month ago

imerelli commented 1 month ago

Hi, when using Jupyter-collaboration on Jupyverse, it seems that staying disconnected for more than about 60 seconds while computing causes the connection to the server to be lost. I’ve done some tests to confirm this. If the page is kept open, everything works fine. If you disconnect for 30 seconds, it works fine. If you stay disconnected for some minutes but the computation lasts for less than 60 seconds, it still works fine. But beyond about 60 seconds of computation in which you are disconnected, the connection that returns the output is lost. Is it possible that there’s an intrinsic timeout somewhere? I’m attaching a screenshot of what happens. I lunched the code, disconnected after few seconds and then reconnected after some minutes, in the first case the output is truncated, while in the second the output is fine.

Screenshot 2024-09-27 at 12 41 38 Screenshot 2024-09-27 at 12 42 13

Here my configuration (and thanks again for the help in setting this up).

pip list | grep jupy
fps_jupyterlab              0.6.2
jupyter_client              8.6.3
jupyter-collaboration       3.0.0b6
jupyter-collaboration-ui    1.0.0b6
jupyter_core                5.7.2
jupyter-docprovider         1.0.0b6
jupyter-events              0.10.0
jupyter-lsp                 2.2.5
jupyter_server              2.14.2
jupyter_server_fileid       0.9.3
jupyter_server_terminals    0.5.3
jupyter-server-ydoc         1.0.0b6
jupyter-ydoc                3.0.0a8
jupyterlab                  4.2.5
jupyterlab_pygments         0.3.0
jupyterlab_server           2.27.3
jupyverse                   0.6.2
jupyverse_api               0.6.2
davidbrochart commented 1 month ago

Why are you using pre-releases of jupyter-collaboration and jupyter-ydoc? Also, how do you launch jupyverse?

imerelli commented 1 month ago

I tested the pre-leases because I thought it could help in solving the issues I have. Below the steps I used for the installation using standard releases of jupyter-collaboration and jupyter-ydoc:

mamba create --name jupyter3 python==3.10

source activate jupyter3

pip install "jupyverse[jupyterlab, auth]"

pip install --upgrade --pre jupyter-collaboration

pip install matplotlib

pip list | grep jupy
fps_jupyterlab              0.6.2
jupyter_client              8.6.3
jupyter_collaboration       2.1.2
jupyter_core                5.7.2
jupyter-events              0.10.0
jupyter-lsp                 2.2.5
jupyter_server              2.14.2
jupyter_server_fileid       0.9.3
jupyter_server_terminals    0.5.3
jupyter-ydoc                2.1.1
jupyterlab                  4.2.5
jupyterlab_pygments         0.3.0
jupyterlab_server           2.27.3
jupyverse                   0.6.2
jupyverse_api               0.6.2

jupyverse --host 0.0.0.0 --port 80 --set kernels.require_yjs=true --set jupyterlab.server_side_execution=true

The problem is the same, see attachment.

Screenshot 2024-09-27 at 18 56 26

Maybe I'm doing something wrong, but, in case, it is not clear to me what. Your help is really appreciated.

davidbrochart commented 1 month ago

Thanks for reporting the issue. I opened https://github.com/jupyter-server/jupyverse/pull/442 which allows configuring the document cleanup delay. It was indeed hard-coded to 60 seconds, that's why you were observing connection loss. To avoid that behavior, you will have to launch jupyverse with the new document_cleanup_delay set to e.g. "inf":

jupyverse --set kernels.require_yjs=true --set jupyterlab.server_side_execution=true --set yjs.document_cleanup_delay="inf"
davidbrochart commented 1 month ago

I released jupyverse v0.6.3.