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

Error when trying to delete users #2766

Closed
lambdaTotoro opened this issue Oct 8, 2019 · 3 comments
Closed

Error when trying to delete users #2766

lambdaTotoro opened this issue Oct 8, 2019 · 3 comments

Comments

@lambdaTotoro
Copy link

Bug Description

I'm running a jupyterHub + jupyterLab setup and during testing found out that I encounter problems when deleting users. I use NativeAuthenticator.
When I click delete on a user (authorised or unauthorised), the panel shows a API request failed (500): Internal Server error and the user does not get deleted, cluttering the database and the interface.

Any idea how to fix this? Or how to get the user out manually, at least?

Log says the following (with substitutions for USER, HOST and ADMIN):

[E 2019-10-08 15:20:01.802 JupyterHub web:1788] Uncaught exception DELETE /hub/api/users/USER (10.20.10.152)
HTTPServerRequest(protocol='https', host='HOST', method='DELETE', uri='/hub/api/users/USER', version='HTTP/1.1', remote_ip='10.20.10.152')
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1699, in _execute
result = await result
File "/usr/local/lib/python3.5/dist-packages/jupyterhub/apihandlers/users.py", line 184, in delete
await maybe_future(self.authenticator.delete_user(user))
File "/root/nativeauthenticator/nativeauthenticator/nativeauthenticator.py", line 217, in delete_user
self.db.delete(user_info)
File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/session.py", line 1992, in delete
raise exc.UnmappedInstanceError(instance)
sqlalchemy.orm.exc.UnmappedInstanceError: Class 'builtins.NoneType' is not mapped

[W 2019-10-08 15:20:01.807 JupyterHub base:111] Rolling back session due to database error Class 'builtins.NoneType' is not mapped
[E 2019-10-08 15:20:01.813 JupyterHub log:166] {
"X-Forwarded-Port": "443",
"Host": "HOST",
"Cookie": "jupyterhub-hub-login=[secret]; jupyterhub-session-id=[secret]; _xsrf=[secret]",
"Accept-Encoding": "gzip, deflate, br",
"X-Forwarded-Proto": "https",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0",
"Content-Length": "0",
"Referer": "HOST/hub/admin?sort=name&order=asc&",
"Accept": "/",
"Connection": "close",
"X-Forwarded-For": "10.20.10.152",
"X-Requested-With": "XMLHttpRequest",
"Accept-Language": "en-US,en;q=0.5",
"Content-Type": "application/json",
"X-Forwarded-Host": "HOST"
}
[E 2019-10-08 15:20:01.813 JupyterHub log:174] 500 DELETE /hub/api/users/USER (ADMIN@10.20.10.152) 31.90ms

To Reproduce

  1. Have a user register through NativeAuthenticator
  2. Authorise the user in admin panel and adduser to create unix system user
  3. Confirm the user can use JupyterLab and have them log out.
  4. deluser the system user.
  5. Try to delete the user in JupyterHub admin panel.

System Information
I'm on Debian 9 and I'm running the following package versions:

jupyter-client (5.3.3)
jupyter-core (4.5.0)
jupyterhub (1.0.0)
jupyterhub-nativeauthenticator (0.0.4, /root/nativeauthenticator)
jupyterlab (1.1.4)
jupyterlab-server (1.0.6)

@ryogesh
Copy link
Contributor

ryogesh commented Oct 9, 2019

"File "/usr/local/lib/python3.5/dist-packages/sqlalchemy/orm/session.py", line 1992, in delete
raise exc.UnmappedInstanceError(instance)
sqlalchemy.orm.exc.UnmappedInstanceError: Class 'builtins.NoneType' is not mapped"

Looks like the user info is coming in as null, check
https://github.com/jupyterhub/nativeauthenticator/blob/master/nativeauthenticator/nativeauthenticator.py#L216

You can check the tables users and user_info to see if there is any mismatch in username... and cleanup .

@lambdaTotoro
Copy link
Author

Thank you for the suggestion. There was indeed a mismatch in usernames. The one in users_info had a capital letter in it, the one in users didn't. This seems like a bug in its own right, but I'll open a different report for that at the appropriate place when I can reliably reproduce it.

@shreeishitagupta
Copy link

Were you able to run native authenticator?

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

No branches or pull requests

3 participants