jupyterhub / the-littlest-jupyterhub

Simple JupyterHub distribution for 1-100 users on a single server
https://tljh.jupyter.org
BSD 3-Clause "New" or "Revised" License
1.05k stars 342 forks source link

Update jupyterhub pinning to >=5.2.0,<6 from ==5.1.0 #1008

Closed consideRatio closed 1 month ago

consideRatio commented 1 month ago

Something is wrong

JupyterHub 5.2.0 logs on server spawn

Oct 20 08:35:05 9ce0cc64b132 python3[3068]: [I 2024-10-20 08:35:05.595 JupyterHub log:192] 302 POST /hub/login -> /hub/spawn (fc621e8f6e9ca691@127.0.0.1) 28.60ms
Oct 20 08:35:05 9ce0cc64b132 python3[3068]: [I 2024-10-20 08:35:05.621 JupyterHub provider:661] Creating oauth client jupyterhub-user-fc621e8f6e9ca691
Oct 20 08:35:05 9ce0cc64b132 useradd[3077]: new group: name=jupyter-fc621e8f6e9ca691, GID=1002
Oct 20 08:35:05 9ce0cc64b132 useradd[3077]: new user: name=jupyter-fc621e8f6e9ca691, UID=1000, GID=1002, home=/home/jupyter-fc621e8f6e9ca691, shell=/bin/sh, from=none
Oct 20 08:35:05 9ce0cc64b132 python3[3085]: Adding user jupyter-fc621e8f6e9ca691 to group jupyterhub-users
Oct 20 08:35:05 9ce0cc64b132 gpasswd[3085]: user jupyter-fc621e8f6e9ca691 added by root to group jupyterhub-users
Oct 20 08:35:05 9ce0cc64b132 python3[3068]: [E 2024-10-20 08:35:05.729 JupyterHub user:1007] Unhandled error starting fc621e8f6e9ca691's server: 'PATH'
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:     Traceback (most recent call last):
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:       File "/opt/tljh/hub/lib/python3.9/site-packages/jupyterhub/user.py", line 920, in spawn
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:         await asyncio.wait_for(f, timeout=spawner.start_timeout)
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:       File "/usr/lib/python3.9/asyncio/tasks.py", line 481, in wait_for
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:         return fut.result()
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:       File "/opt/tljh/hub/lib/python3.9/site-packages/systemdspawner/systemdspawner.py", line 288, in start
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:         curpath=env["PATH"],
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:     KeyError: 'PATH'
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:     
Oct 20 08:35:05 9ce0cc64b132 python3[3068]: [E 2024-10-20 08:35:05.760 JupyterHub pages:312] Error starting server fc621e8f6e9ca691: 'PATH'
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:     Traceback (most recent call last):
Oct 20 08:35:05 9ce0cc64b132 python3[3068]:     None: None

Investigation

With https://github.com/jupyterhub/jupyterhub/pull/4904, the Spawner base class had its env_keep default value changed, to for example not include PATH. The default value of LocalProcessSpawner was unchanged, but SystemdSpawner used by tljh inherits from Spawner, so it has been impacted.

I'm not confident on whats a sufficient fix yet, or where - it could be systemdspawner, tljh, or jupyterhub.

I think its systemdspawner to begin with, because I think its test suite would fail if SystemdSpawner.extra_paths where configured when used against jupyterhub 5.2.0, which it isn't in the test suite, but extra_paths is configured by tljh.

I've opened https://github.com/jupyterhub/systemdspawner/pull/144 so far about this, and have tried it in 2cb3bab.