SthPhoenix/InsightFace-REST

[ERROR] Exception in ASGI application

hamzaziizzz opened this issue · 4 comments

@SthPhoenix

2024-03-09 09:54:29 Traceback (most recent call last):
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py", line 412, in run_asgi
2024-03-09 09:54:29     result = await app(  # type: ignore[func-returns-value]
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
2024-03-09 09:54:29     return await self.app(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 1054, in __call__
2024-03-09 09:54:29     await super().__call__(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 123, in __call__
2024-03-09 09:54:29     await self.middleware_stack(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 186, in __call__
2024-03-09 09:54:29     raise exc
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 164, in __call__
2024-03-09 09:54:29     await self.app(scope, receive, _send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 62, in __call__
2024-03-09 09:54:29     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-03-09 09:54:29     raise exc
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-03-09 09:54:29     await app(scope, receive, sender)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 758, in __call__
2024-03-09 09:54:29     await self.middleware_stack(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 778, in app
2024-03-09 09:54:29     await route.handle(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 299, in handle
2024-03-09 09:54:29     await self.app(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 79, in app
2024-03-09 09:54:29     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-03-09 09:54:29     raise exc
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-03-09 09:54:29     await app(scope, receive, sender)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 74, in app
2024-03-09 09:54:29     response = await func(request)
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 278, in app
2024-03-09 09:54:29     raw_response = await run_endpoint_function(
2024-03-09 09:54:29   File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 191, in run_endpoint_function
2024-03-09 09:54:29     return await dependant.call(**values)
2024-03-09 09:54:29   File "/app/app.py", line 92, in extract
2024-03-09 09:54:29     output = await processing.extract(images, max_size=data.max_size, return_face_data=data.return_face_data,
2024-03-09 09:54:29 AttributeError: 'NoneType' object has no attribute 'extract'

I'm getting this error on NVIDIA RTX 4050

Hi @hamzaziizzz ,

I met the same error on NVIDIA RTX 2080Ti as well. Have you solved this?
Thanks!

Hi @hamzaziizzz ,

I think I have fixed this error in my situation.

I failed to download the correct weight files and the auto re-download also failed due to bad network connection. This led to errors in inference.

Maybe @SthPhoenix could consider on checking the success state of loading the weight file?

Looks like various errors during processing module initialization may lead to silent fail, followed by this exception, I'll try to add more checks at startup to make module fail as early as possible to leave actual stack trace in console.

Looks like various errors during processing module initialization may lead to silent fail, followed by this exception, I'll try to add more checks at startup to make module fail as early as possible to leave actual stack trace in console.

A have committed small fix that should exit app if processing module failed to load