Jupyterhub file browser folders disappear constantly


JupyterHub has been installed on ubuntu 22.04 and connected to the active directory with sssd. A user account will automatically be created when a windows user logs onto the jupyterhub. A symbolic link will automatically be made from the user home folder tot the mounted volume. The mounted volume is a CIFS share version 2.0. Now when a user logs in on the JupyterHub server everything is fine and usable, except for the ‘visual part’ of the folder structure that will occasionally disappear, only when running ls -l it appears again.

Expected behaviour

It is expected that the file browser keeps the projects share visually available.

Actual behaviour

Only top-level maps are visually available when a underlying file/folder is used.

How to reproduce

  1. create a symbolic link between home folder of a user and the /mnt/name
  2. launch jupyterhub server from url
  3. If the server has restarted recently or ls -l is run you will see the folders in the left pane
  4. After approx. 30 minutes the folders will dissapear

Your personal set up

Operating System and version: Linux Ubuntu 22.04
Browser and version: 113.0.5672.127
JupyterLab version: 3.4.7
Windows server version: 2019 Distributed file system/ CIFS 2.0 share

Configuration for spawner and authenticator:

import os
import pwd
import shutil
def create_dir_hook(spawner):
    username = spawner.user.name # get the username
    username1 = username.replace(".com", ".local")
    home_path = os.path.join('/home', username1)
    projecten = "projecten"
    dir = os.path.join(home_path,projecten)
    dst = "/mnt/projecten"
    if not os.path.exists(home_path):
        os.mkdir(home_path, 0o777)
# attach the hook function to the spawner
c.Spawner.pre_spawn_hook = create_dir_hook

Authenticator: Default (PAM) with SSSD

Assuming you’re using the default contents manager JupyterLab should just list whatever’s on the filesystem. If it keeps disappearing that could be a problem with how Ubuntu, active directory or CIFS are configured. If after a few days no-one on this forum has a solution it’s probably worth asking on a Linux/Windows sysadmin forum, and sharing your answer here to help people in future.

Things that might be worth checking:

  1. does reloading the browser change what is viewed?
  2. are there any logs from the server when this happens?
  3. what are the outputs from the APIs that the ContentsManager calls

You can even test by instantiating a ContentsManager yourself and poke around:

import os
from jupyter_server.services.contents.filemanager import FileContentsManager
cm = FileContentsManager(path=os.getcwd())
listing = cm.get("/")

It could be an issue in how either JupyterLab queries info about files or how the underlying system reports them. There are several ways for this to fail, and if it fails on a file it will not be included in the list. Most of these failures are accompanied by logs, which should help figure out what needs to be fixed. If you find something wrong in Jupyter Server’s handling, please open an issue on jupyter-server with details.