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

The document session expired. you need to reload this browser tab. #14268

Open
linuxpham opened this issue Mar 23, 2023 · 11 comments
Open

The document session expired. you need to reload this browser tab. #14268

linuxpham opened this issue Mar 23, 2023 · 11 comments

Comments

@linuxpham
Copy link

  1. Jupyterhub : 3.1.1
  2. Jupyterlab : 3.6.2
  3. plugins : jupyterlab_server=2.21.0 jupyter_server=2.5.0 jupyter-ydoc==0.2.3 jupyter_server_ydoc==0.8.0

Error : The document session expired. you need to reload this browser tab.

@linuxpham linuxpham added the bug label Mar 23, 2023
@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label Mar 23, 2023
@welcome
Copy link

welcome bot commented Mar 23, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

@JasonWeill
Copy link
Contributor

@linuxpham I'm not sure what the error is here. Sessions do expire after a period of time. Do you still see the error immediately after you reload your browser tab?

@hbcarlos
Copy link
Member

Hi @linuxpham. Thanks for taking the time to open the issue.

This is not a bug. The message prevents you from continuing to edit a document with an expired session.

@linuxpham
Copy link
Author

Hi @hbcarlos : I try to reload my browser many times. I do not think that my session expired.

@linuxpham
Copy link
Author

Hi @hbcarlos : this error only displays when I enable collaborative mode in JupyterLab.

@hbcarlos
Copy link
Member

Hi @linuxpham.

this error only displays when I enable collaborative mode in JupyterLab.

Yes, that dialog is related to Real-time collaboration.

I try to reload my browser many times. I do not think that my session expired.

After reloading the tab, do you know if the dialog appears again?

I can see you are using JupyterHub. Usually, when you launch a JupyterLab instance from JupyterHub, after X minutes of inactivity, JupyterHub shuts down the JupyterLab instance, and you need to launch a new one. This "session" is a server session. Every time you launch a new JupyterLab instance from JupyterHub, if you have a browser tab already open with JupyterLab, you need to reload it to clean the documents from memory and load them again.

Is that the behavior you see? If not, please give us more context and the steps to reproduce the issue.

@hbcarlos hbcarlos added tag:Real Time Collaboration and removed status:Needs Triage Applied to new issues that need triage labels Mar 30, 2023
@hbcarlos hbcarlos self-assigned this Mar 30, 2023
@linuxpham
Copy link
Author

linuxpham commented Mar 31, 2023

Hi @hbcarlos ,

I did these steps :

  1. stop jupyterhub, stop singlelab , killall : python, nodejs process

  2. enable collaborative mode

  3. start jupyterhub

This issue still stays here. I tried to reload my browser many times. I do not think that my session has expired.

@hbcarlos
Copy link
Member

hbcarlos commented Apr 3, 2023

Hey @linuxpham. I just tried it, and I can not reproduce it.

  1. stop jupyterhub, stop singlelab , killall : python, nodejs process
  2. enable collaborative mode
  3. start jupyterhub

Did you close every browser tab with jupyterlab open between steps 1 and 3?

I need more information to be able to debug it. When opening an issue in this repository, there is a template to fill out. In this concrete issue, apart from the info requested in the template, I will need to know your JupyterHub configuration as well as what extensions you have installed.

In collaborative mode, when you stop the jupyterlab instance and launch a new one, you must reload your browser tab because the session has expired (you are no longer connected to the same server instance). Otherwise, you might lose the content of the document you are working on. When you stop the jupyterlab instance, if you forget to close the browser tab, you will see the message popping up in your old browser tab to force you to reload the window once you launch a new instance. That error message is there on purpose, and it should go away once you reload the tab.

If, after reloading the tab, you still see the message, that is an issue, but I can not reproduce it on my side.

@linuxpham
Copy link
Author

linuxpham commented Apr 5, 2023

Hey @hbcarlos :

  1. This error is still displayed (when I enable COLLABORATIVE_MODE)

  2. This is jupyterhub config (/miniconda/user/bin/jupyterhub --config /configs/hub/etc/config.py --ip 0.0.0.0 --port 18000 --no-ssl)

`
from mycompany.hub.handlers import bioturing_handlers
from mycompany.hub.spawner.creating import UserCreatingSpawner
from mycompany.hub.auth.bioauth import RemoteUserAuthenticator
from mycompany.hub.define import DEBUG_MODE, HUB_API_KEY, SCHEDULER_DB_CONN_URI,
HUB_SECRET_PATH, HUB_DB_CONN_URI, APP_DOMAIN_URL, MAX_UPLOAD_FILE_SIZE,
HUB_DB_STORAGE_PATH, HUB_SECRET_COOKIE, OPENAI_KEY, COLLABORATIVE_MODE
import logging
import traitlets.log
import os

ADMIN_ID = 'admin'
ADMIN_IDLE_ID = 'jupyterhub-idle-culler-service'
ADMIN_IDS = {
ADMIN_ID
}
ADMIN_IDLE_SECRET = 'xxxxxxxxxx'

c = get_config()
c.FileContentsManager.delete_to_trash = False

c.JupyterHub.authenticator_class = RemoteUserAuthenticator
c.Authenticator.admin_users = ADMIN_IDS
c.Authenticator.delete_invalid_users = False
c.JupyterHub.service_tokens = {
HUB_API_KEY: ADMIN_ID,
ADMIN_IDLE_SECRET: ADMIN_IDLE_ID,
}
c.JupyterHub.load_roles = [
{
"name": "jupyterhub-idle-culler-role",
'description': 'Allows parties to start and stop user servers',
"scopes": [
"list:users",
"read:users:activity",
"read:servers",
"delete:servers",
"access:servers"
],
'users': ADMIN_IDS,
"services": [ADMIN_IDLE_ID],
'groups': ['admin-group'],
},
{
'name': 'server-rights',
'description': 'Allows parties to start and stop user servers',
'scopes': [
'servers',
'admin:users',
'admin:servers',
'read:servers',
'access:servers'
],
'users': ADMIN_IDS,
'services': [ADMIN_ID],
'groups': ['admin-group'],
}
]

c.LocalAuthenticator.create_system_users = False
c.JupyterHub.spawner_class = UserCreatingSpawner
c.JupyterHub.cleanup_servers = True

c.GPT3ModelEngine.api_key = OPENAI_KEY
c.IPKernelApp.pylab = 'inline'

c.NotebookApp.allow_origin = ''
c.NotebookApp.ip = '
'
c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False

if not os.path.exists(HUB_DB_STORAGE_PATH):
os.makedirs(HUB_DB_STORAGE_PATH)
if (HUB_SECRET_COOKIE is None) or (len(HUB_SECRET_COOKIE) == 0):
c.JupyterHub.cookie_secret_file = HUB_SECRET_PATH
else:
c.JupyterHub.cookie_secret = bytes.fromhex(HUB_SECRET_COOKIE)
c.JupyterHub.db_url = HUB_DB_CONN_URI
c.SchedulerApp.drop_tables = False
c.SchedulerApp.db_url = SCHEDULER_DB_CONN_URI
c.Spawner.args = [
'--NotebookApp.allow_origin=*',
'--NotebookApp.enable_mathjax=True',
'--ContentsManager.allow_hidden=True',
'--HdfConfig.resolve_links=True',
'--NotebookApp.default_url=/lab/',
'--LabServerApp.notebook_starts_kernel=True',
'--LabServerApp.disable_check_xsrf=True',
'--KernelSpecManager.ensure_native_kernel=False',
'--NotebookApp.open_browser=False',
'--NotebookApp.terminals_enabled=True',
'--NotebookApp.shutdown_no_activity_timeout=7200'
'--TerminalManager.cull_inactive_timeout=10800'
'--TerminalManager.cull_interval=600'
]
if COLLABORATIVE_MODE == True:
c.Spawner.args.append('--LabApp.collaborative=True')
else:
c.Spawner.args.append('--LabApp.collaborative=False')

c.JupyterHub.tornado_settings = {
'headers': {
'Access-Control-Allow-Origin': "",
'Access-Control-Allow-Credentials': "true",
'Access-Control-Allow-Headers': "
",
'Access-Control-Allow-Methods': "POST, HEAD, GET, OPTIONS, PUT, DELETE",
},
'slow_spawn_timeout': 180,
'compiled_template_cache': True,
'autoreload': False,
'static_hash_cache': True
}

c.Spawner.http_timeout = 180
c.Spawner.start_timeout = 180
c.Spawner.default_url = '/lab/'
c.JupyterHub.template_paths = ['/configs/hub/templates']
c.Spawner.cmd = "colab-jupyterhub-singleuser"
c.JupyterHub.concurrent_spawn_limit = 2000

c.JupyterHub.extra_handlers = bioturing_handlers
c.JupyterHub.services = [
{
"name": ADMIN_ID,
"api_token": HUB_API_KEY,
"admin": True,
},
{
"name": ADMIN_IDLE_ID,
"api_token": ADMIN_IDLE_SECRET,
"admin": True,
},
]
c.JupyterHub.allow_named_servers = True
def named_server_limit_per_user_fn(handler):
user = handler.current_user
if user and user.admin:
return 0
return 50
c.JupyterHub.named_server_limit_per_user = named_server_limit_per_user_fn

log_path = '/logs/jupyterhub.log'
h = logging.handlers.RotatingFileHandler(
log_path, backupCount=3, maxBytes=1010241024)
formatter = logging.Formatter(
"[%(levelname)1.1s %(asctime)s %(name)s %(module)s:%(lineno)d] %(message)s"
)
h.setFormatter(formatter)
root_log = traitlets.log.get_logger()
root_log.addHandler(h)

c.JupyterHub.log_level = 1
if DEBUG_MODE == True:
c.JupyterHub.log_level = 10
c.JupyterHub.extra_log_file = log_path
c.Spawner.debug = DEBUG_MODE

c.JupyterHub.shutdown_on_logout = True
c.Spawner.environment = {
"APP_DOMAIN_URL": APP_DOMAIN_URL,
"MAX_UPLOAD_FILE_SIZE": MAX_UPLOAD_FILE_SIZE
}

c.JupyterHub.admin_access = True
c.JupyterHub.hub_ip = '0.0.0.0'
c.JupyterHub.hub_port = 18081
c.ConfigurableHTTPProxy.should_start = True
c.ConfigurableHTTPProxy.api_url = 'http://127.0.0.1:18001'
c.JupyterHub.logo_file = '/configs/hub/logo.png'

c.ResourceUseDisplay.mem_limit = 40 * 102410241024
c.ResourceUseDisplay.track_cpu_percent = True
c.ResourceUseDisplay.cpu_limit = 4
c.ResourceUseDisplay.mem_warning_threshold = 0.1
c.ResourceUseDisplay.track_cpu_percent = True
c.ResourceUseDisplay.enable_prometheus_metrics = False

c.MultiKernelManager.default_kernel_name = 'python3'
c.MappingKernelManager.cull_idle_timeout = 86400
c.MappingKernelManager.cull_interval=600
c.MappingKernelManager.cull_connected = True
c.MappingKernelManager.cull_busy = False
`

  1. This is the
    Screenshot 2023-04-05 at 10 20 03
    error screen

@linuxpham
Copy link
Author

Hi @hbcarlos ,

Is there any update about this issue?

Thank you so much!

@larrygao001
Copy link

Facing the same issue. Can we get some updates?

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

No branches or pull requests

4 participants