marieai / marie-ai

Integrate AI-powered Document Analysis Pipelines
MIT License
60 stars 5 forks source link

Exception in ASGI application #73

Closed gregbugaj closed 1 year ago

gregbugaj commented 1 year ago

After certain amount of time the application gets into invalid state and keeps throwing bellow exception.

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/opt/venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/opt/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/opt/venv/lib/python3.10/site-packages/fastapi/applications.py", line 282, in __call__
    await super().__call__(scope, receive, send)
  File "/opt/venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/opt/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 14, in __call__
    async with AsyncExitStack() as stack:
  File "/usr/lib/python3.10/contextlib.py", line 672, in __aexit__
    frame_exc = sys.exc_info()[1]
TypeError: 'tuple' object is not callable
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/opt/venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/opt/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/opt/venv/lib/python3.10/site-packages/fastapi/applications.py", line 282, in __call__
    await super().__call__(scope, receive, send)
  File "/opt/venv/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/opt/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/opt/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 14, in __call__
    async with AsyncExitStack() as stack:
  File "/usr/lib/python3.10/contextlib.py", line 672, in __aexit__
    frame_exc = sys.exc_info()[1]
TypeError: 'tuple' object is not callable

One way to test this is to send payload with non existing S3 asset

    json_payload = {
        "queue_id": uid,
        # "data": base64_str,
        "uri": "s3://marie/incoming/NON_EXISTING.tif",
        "mode": mode,
        "output": "json",
        "doc_id": f"greg-{uid}",
        "doc_type": "overlay",
        # "features": [{"type": "LABEL_DETECTION", "maxResults": 1}],
    }