jupyterhub / wrapspawner

Mechanism for runtime configuration of spawners for JupyterHub
BSD 3-Clause "New" or "Revised" License
60 stars 57 forks source link

ProfileSpawner does not implement c.SystemUserSpawner.remove=False correctly #43

Open lukas-koschmieder opened 3 years ago

lukas-koschmieder commented 3 years ago

Bug description

Running SystemUserSpawner through ProfileSpawner won't work correctly if c.SystemUserSpawner.remove = False is set in jupyterhub_config.py.

c.SystemUserSpawner.remove = False informs SystemUserSpawner not to automatically remove the Docker container if the user stops the server. This feature is extremly useful because it gives users the ability to install persistent packages.

Error message (web client):

500 : Internal Server Error
The error was:
Failed to check authorization: invalid_client

Cause

This bug occurs because ProfileSpawner always removes the user token from the oauth_clients table if the user stops the notebook server. SystemUserSpawner assumes that the user token remains in oauth_clients if c.SystemUserSpawner.remove = False.

Edit: Actually, this is only a part of the problem... Restoring the token in the database alone does not automatically fix the bug. Maybe someone who knows how the authentication works in more detail, could take a deeper look?

How to reproduce

  1. Navigate to hub/home
  2. Hit "Start My Server"
  3. As soon as the Notebook Server is running, hit "Control Panel"
    • This will redirect you back to hub/home
  4. Hit "Stop My Server"
    • This will stop the Docker container
  5. Hit "Start My Server"
    • This will restart the Docker container and redirect you to user/foo but instead of the notebook interface the above error message will appear
welcome[bot] commented 3 years ago

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
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! :wave:
Welcome to the Jupyter community! :tada: