Hello!!

El vie, 21 jun 2024 a la(s) 7:51 a.m., Michael Kussmaul (
michael.kussm...@nix.ch) escribió:

> Package: glances
> Version: 4.0.5+dfsg-1
>
> I use glances with Debian testing and with API mode, so I can query
> glances parameters over the included REST interface:
>
> glances -w --disable-webui -B 0.0.0.0
>
> But since version 4, this seems to be broken in Debian, because there is
> no "orjson" library found (orjson python package is not available in Debian
> testing).
>
> Steps to reproduce:
>
> 1.) start glances in RESTful API mode:
>      glances -w --disable-webui -B 0.0.0.0
> 2.) access API, eg. status:
>      curl http://localhost:61208/api/4/status
>
> it returns: "Internal Server Error"
>
> and glances log-file logs the following error message:
>
> Jun 21 10:20:47 mapout systemd[1]: Started glances.service - Glances.
>
> Jun 21 10:20:47 mapout glances[1168]: INFO:     Started server process
> [1168]
>
> Jun 21 10:20:47 mapout glances[1168]: INFO:     Waiting for application
> startup.
>
> Jun 21 10:20:47 mapout glances[1168]: INFO:     Application startup
> complete.
>
> Jun 21 10:20:47 mapout glances[1168]: INFO:     Uvicorn running on
> http://0.0.0.0:61208 (Press CTRL+C to quit)
>
> Jun 21 14:23:41 mapout glances[1168]: ERROR:    Exception in ASGI
> application
>
> Jun 21 14:23:41 mapout glances[1168]: Traceback (most recent call last):
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/uvicorn/protocols/http/h11_impl.py", line
> 407, in run_asgi
>
> Jun 21 14:23:41 mapout glances[1168]:     result = await app(  # type:
> ignore[func-returns-value]
>
> Jun 21 14:23:41 mapout glances[1168]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/uvicorn/middleware/proxy_headers.py", line
> 69, in __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     return await self.app(scope,
> receive, send)
>
> Jun 21 14:23:41 mapout glances[1168]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/fastapi/applications.py", line 1054, in
> __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     await super().__call__(scope,
> receive, send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/applications.py", line 123, in
> __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     await
> self.middleware_stack(scope, receive, send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/middleware/errors.py", line 186,
> in __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     raise exc
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/middleware/errors.py", line 164,
> in __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     await self.app(scope, receive,
> _send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/middleware/gzip.py", line 26, in
> __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     await self.app(scope, receive,
> send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/middleware/cors.py", line 85, in
> __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     await self.app(scope, receive,
> send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/middleware/exceptions.py", line
> 65, in __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     await
> wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/_exception_handler.py", line 64,
> in wrapped_app
>
> Jun 21 14:23:41 mapout glances[1168]:     raise exc
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/_exception_handler.py", line 53,
> in wrapped_app
>
> Jun 21 14:23:41 mapout glances[1168]:     await app(scope, receive, sender)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/routing.py", line 756, in __call__
>
> Jun 21 14:23:41 mapout glances[1168]:     await
> self.middleware_stack(scope, receive, send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/routing.py", line 776, in app
>
> Jun 21 14:23:41 mapout glances[1168]:     await route.handle(scope,
> receive, send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/routing.py", line 297, in handle
>
> Jun 21 14:23:41 mapout glances[1168]:     await self.app(scope, receive,
> send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/routing.py", line 77, in app
>
> Jun 21 14:23:41 mapout glances[1168]:     await
> wrap_app_handling_exceptions(app, request)(scope, receive, send)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/_exception_handler.py", line 64,
> in wrapped_app
>
> Jun 21 14:23:41 mapout glances[1168]:     raise exc
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/_exception_handler.py", line 53,
> in wrapped_app
>
> Jun 21 14:23:41 mapout glances[1168]:     await app(scope, receive, sender)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/routing.py", line 72, in app
>
> Jun 21 14:23:41 mapout glances[1168]:     response = await func(request)
>
> Jun 21 14:23:41 mapout glances[1168]:                ^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/fastapi/routing.py", line 278, in app
>
> Jun 21 14:23:41 mapout glances[1168]:     raw_response = await
> run_endpoint_function(
>
> Jun 21 14:23:41 mapout glances[1168]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/fastapi/routing.py", line 193, in
> run_endpoint_function
>
> Jun 21 14:23:41 mapout glances[1168]:     return await
> run_in_threadpool(dependant.call, **values)
>
> Jun 21 14:23:41 mapout glances[1168]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/concurrency.py", line 42, in
> run_in_threadpool
>
> Jun 21 14:23:41 mapout glances[1168]:     return await
> anyio.to_thread.run_sync(func, *args)
>
> Jun 21 14:23:41 mapout glances[1168]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/anyio/to_thread.py", line 56, in run_sync
>
> Jun 21 14:23:41 mapout glances[1168]:     return await
> get_async_backend().run_sync_in_worker_thread(
>
> Jun 21 14:23:41 mapout glances[1168]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/anyio/_backends/_asyncio.py", line 2144, in
> run_sync_in_worker_thread
>
> Jun 21 14:23:41 mapout glances[1168]:     return await future
>
> Jun 21 14:23:41 mapout glances[1168]:            ^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/anyio/_backends/_asyncio.py", line 851, in
> run
>
> Jun 21 14:23:41 mapout glances[1168]:     result = context.run(func, *args)
>
> Jun 21 14:23:41 mapout glances[1168]:              ^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/glances/outputs/glances_restful_api.py",
> line 361, in _api_status
>
> Jun 21 14:23:41 mapout glances[1168]:     return
> ORJSONResponse({'version': __version__})
>
> Jun 21 14:23:41 mapout glances[1168]:
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/responses.py", line 184, in
> __init__
>
> Jun 21 14:23:41 mapout glances[1168]:     super().__init__(content,
> status_code, headers, media_type, background)
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/starlette/responses.py", line 41, in
> __init__
>
> Jun 21 14:23:41 mapout glances[1168]:     self.body = self.render(content)
>
> Jun 21 14:23:41 mapout glances[1168]:                 ^^^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]:   File
> "/usr/lib/python3/dist-packages/fastapi/responses.py", line 45, in render
>
> Jun 21 14:23:41 mapout glances[1168]:     assert orjson is not None,
> "orjson must be installed to use ORJSONResponse"
>
> Jun 21 14:23:41 mapout glances[1168]:            ^^^^^^^^^^^^^^^^^^
>
> Jun 21 14:23:41 mapout glances[1168]: AssertionError: orjson must be
> installed to use ORJSONResponse
>

Thanks for your report!

Yes, you are right, unfortunately, python-orjson isn't included in debian
archive yet[1], so I will work to can include this to fix this problem.

Regards.

[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1002996


-- 
Daniel Echeverri
Debian Developer
Linux user: #477840
GPG Fingerprint:
D0D0 85B1 69C3 BFD9 4048 58FA 21FC 2950 4B52 30DB

Reply via email to