run-llama/sec-insights

anyio.ClosedResourceError

Opened this issue ยท 3 comments

I've noticed an anyio.ClosedResourceError is raised intermittently on the backend server when making queries through the frontend conversation interface. I'm unsure the cause of this error and whether it affects the generated response.

I've seen this exception raised at times when I get a response that relevant context cannot be found, but also at times when I get an accurate response to the same query.

It seems to happen randomly (i.e., does not always re-appear when I repeat a query that caused it). I see there was a pull reqest in November 2023 to fix what appears to be the same issue by upgrading to LlamaIndex v0.9.7. However, I am seeing this issue while running the app locally from Codespace using the latest version of the main branch, which includes this version of LlamaIndex.

2024-03-01 - anyio ClosedResourceError - CLI - 01

I'm hitting this as well after sending a trivial "Hi" message:

INFO:     Application startup complete.
INFO:     127.0.0.1:37042 - "POST /api/conversation/ HTTP/1.1" 200 OK
INFO:     127.0.0.1:36654 - "GET /api/conversation/887effde-15d6-445d-a39e-0ae0409eaaaf HTTP/1.1" 200 OK
INFO:     127.0.0.1:36656 - "GET /api/conversation/887effde-15d6-445d-a39e-0ae0409eaaaf/message?user_message=Hi HTTP/1.1" 200 OK
STARTING TURN 1
---------------

Tried sending SubProcess event (source=MessageSubProcessSourceEnum.AGENT_STEP) after channel was closed
Traceback (most recent call last):
  File "/home/gancaycomaria/Projects/break-rag/sec-insights/backend/app/chat/messaging.py", line 106, in async_on_event
    await self._send_chan.send(
  File "/home/gancaycomaria/.cache/pypoetry/virtualenvs/llama-app-backend-FAwTdoAI-py3.11/lib/python3.11/site-packages/anyio/streams/memory.py", line 213, in send
    self.send_nowait(item)
  File "/home/gancaycomaria/.cache/pypoetry/virtualenvs/llama-app-backend-FAwTdoAI-py3.11/lib/python3.11/site-packages/anyio/streams/memory.py", line 195, in send_nowait
    raise ClosedResourceError
anyio.ClosedResourceError

Any updates from the sec-insights team? Thank you so much for this work! (Trying to find your discord so I can investigate/research this more)

I'm hitting this as well after sending a trivial "Hi" message:

INFO:     Application startup complete.
INFO:     127.0.0.1:37042 - "POST /api/conversation/ HTTP/1.1" 200 OK
INFO:     127.0.0.1:36654 - "GET /api/conversation/887effde-15d6-445d-a39e-0ae0409eaaaf HTTP/1.1" 200 OK
INFO:     127.0.0.1:36656 - "GET /api/conversation/887effde-15d6-445d-a39e-0ae0409eaaaf/message?user_message=Hi HTTP/1.1" 200 OK
STARTING TURN 1
---------------

Tried sending SubProcess event (source=MessageSubProcessSourceEnum.AGENT_STEP) after channel was closed
Traceback (most recent call last):
  File "/home/gancaycomaria/Projects/break-rag/sec-insights/backend/app/chat/messaging.py", line 106, in async_on_event
    await self._send_chan.send(
  File "/home/gancaycomaria/.cache/pypoetry/virtualenvs/llama-app-backend-FAwTdoAI-py3.11/lib/python3.11/site-packages/anyio/streams/memory.py", line 213, in send
    self.send_nowait(item)
  File "/home/gancaycomaria/.cache/pypoetry/virtualenvs/llama-app-backend-FAwTdoAI-py3.11/lib/python3.11/site-packages/anyio/streams/memory.py", line 195, in send_nowait
    raise ClosedResourceError
anyio.ClosedResourceError

Any updates from the sec-insights team? Thank you so much for this work! (Trying to find your discord so I can investigate/research this more)

FWIW, I'm unfortunately seeing this both in GitHub codespaces and in my local setup.

It seems that a deprecated model is hard-coded in the source

image

https://platform.openai.com/docs/deprecations/2023-11-06-chat-model-updates