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

[ENH] - An admin stopping a server created by another user does not work (on Nebari) #575

Open
Adam-D-Lewis opened this issue Jan 28, 2025 · 1 comment

Comments

@Adam-D-Lewis
Copy link
Member

Adam-D-Lewis commented Jan 28, 2025

Feature description

Not sure if this is specific to Nebari, but when an admin user tries to stop a server created by another user in the UI, the UI shows server stopped successfully, but the logs show an error occurred. Logs are below. In this case my user tried to stop a lumenai server created by someone else.

2025-01-28 18:39:09,701      INFO httpx:1740: HTTP Request: GET http://hub:8081/hub/api/user "HTTP/1.1 200 OK"
    |     await app(scope, receive, sender)
    |   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 715, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 735, in app
    |     await route.handle(scope, receive, send)
    |   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 288, in handle
    |     await self.app(scope, receive, send)
    |   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 76, in app
    |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    |   File "/opt/conda/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     raise exc
    |   File "/opt/conda/lib/python3.9/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 73, in app
    |     response = await f(request)
    |   File "/opt/conda/lib/python3.9/site-packages/fastapi/routing.py", line 301, in app
    |     raw_response = await run_endpoint_function(
    |   File "/opt/conda/lib/python3.9/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    |     return await dependant.call(**values)
    |   File "/opt/conda/lib/python3.9/site-packages/jhub_apps/service/routes.py", line 240, in delete_server
    |     return hub_client.delete_server(user.name, server_name=server_name, remove=remove)
    |   File "/opt/conda/lib/python3.9/site-packages/jhub_apps/hub_client/hub_client.py", line 33, in wrapper
    |     raise e
    |   File "/opt/conda/lib/python3.9/site-packages/jhub_apps/hub_client/hub_client.py", line 31, in wrapper
    |     original_method_return = func(self, *args, **kwargs)
    |   File "/opt/conda/lib/python3.9/site-packages/jhub_apps/hub_client/hub_client.py", line 318, in delete_server
    |     r.raise_for_status()
    |   File "/opt/conda/lib/python3.9/site-packages/requests/models.py", line 1024, in raise_for_status
    |     raise HTTPError(http_error_msg, response=self)
    | requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://hub:8081/hub/api/users/[email protected]/servers/lumenai
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/opt/conda/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
    return await self.app(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/opt/conda/lib/python3.9/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/middleware/base.py", line 189, in __call__
    response_sent.set()
  File "/opt/conda/lib/python3.9/contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/opt/conda/lib/python3.9/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
    raise exc
  File "/opt/conda/lib/python3.9/site-packages/starlette/middleware/base.py", line 187, in __call__
    response = await self.dispatch_func(request, call_next)
  File "/opt/conda/lib/python3.9/site-packages/jhub_apps/service/middlewares.py", line 16, in logging_middleware
    response: Response = await call_next(request)
  File "/opt/conda/lib/python3.9/site-packages/starlette/middleware/base.py", line 163, in call_next
    raise app_exc
  File "/opt/conda/lib/python3.9/site-packages/starlette/middleware/base.py", line 149, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/opt/conda/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/opt/conda/lib/python3.9/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/opt/conda/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    raise exc
  File "/opt/conda/lib/python3.9/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
    await app(scope, receive, sender)
  File "/opt/conda/lib/python3.9/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
  File "/opt/conda/lib/python3.9/site-packages/fastapi/routing.py", line 301, in app
    raw_response = await run_endpoint_function(
  File "/opt/conda/lib/python3.9/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/conda/lib/python3.9/site-packages/jhub_apps/service/routes.py", line 240, in delete_server
    return hub_client.delete_server(user.name, server_name=server_name, remove=remove)
  File "/opt/conda/lib/python3.9/site-packages/jhub_apps/hub_client/hub_client.py", line 33, in wrapper
    raise e
  File "/opt/conda/lib/python3.9/site-packages/jhub_apps/hub_client/hub_client.py", line 31, in wrapper
    original_method_return = func(self, *args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/jhub_apps/hub_client/hub_client.py", line 318, in delete_server
    r.raise_for_status()
  File "/opt/conda/lib/python3.9/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://hub:8081/hub/api/users/[email protected]/servers/lumenai

Value and/or benefit

bug fix

Anything else?

Servers are able to be stopped successfully by going to jupyterhub's admin panel and stopping them there.

@aktech
Copy link
Member

aktech commented Feb 12, 2025

I believe this is disabled for now, as in stopped servers can be started by people having access to the shared server but not other way around, but yes the UI could better reflect on what happened.

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

2 participants