This problem occurs intermittently, what could be the reason?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
2024-04-29 00:55:07 | ERROR | stderr | ERROR: Exception in ASGI application
2024-04-29 00:55:07 | ERROR | stderr | Traceback (most recent call last):
2024-04-29 00:55:07 | ERROR | stderr | File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 264, in __call__
2024-04-29 00:55:07 | ERROR | stderr | await wrap(partial(self.listen_for_disconnect, receive))
2024-04-29 00:55:07 | ERROR | stderr | File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 260, in wrap
2024-04-29 00:55:07 | ERROR | stderr | await func()
2024-04-29 00:55:07 | ERROR | stderr | File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 237, in listen_for_disconnect
2024-04-29 00:55:07 | ERROR | stderr | message = await receive()
2024-04-29 00:55:07 | ERROR | stderr | File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 571, in receive
2024-04-29 00:55:07 | ERROR | stderr | await self.message_event.wait()
2024-04-29 00:55:07 | ERROR | stderr | File "/usr/local/lib/python3.9/asyncio/locks.py", line 226, in wait
2024-04-29 00:55:07 | ERROR | stderr | await fut
2024-04-29 00:55:07 | ERROR | stderr | asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f4870a5bbe0
2024-04-29 00:55:07 | ERROR | stderr |
2024-04-29 00:55:07 | ERROR | stderr | During handling of the above exception, another exception occurred:
2024-04-29 00:55:07 | ERROR | stderr |
2024-04-29 00:55:07 | ERROR | stderr | + Exception Group Traceback (most recent call last):
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 412, in run_asgi
2024-04-29 00:55:07 | ERROR | stderr | | result = await app( # type: ignore[func-returns-value]
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | return await self.app(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | await super().__call__(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 123, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | await self.middleware_stack(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 186, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | raise exc
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 164, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | await self.app(scope, receive, _send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/middleware/cors.py", line 83, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | await self.app(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-04-29 00:55:07 | ERROR | stderr | | raise exc
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-04-29 00:55:07 | ERROR | stderr | | await app(scope, receive, sender)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 758, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | await self.middleware_stack(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 778, in app
2024-04-29 00:55:07 | ERROR | stderr | | await route.handle(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 299, in handle
2024-04-29 00:55:07 | ERROR | stderr | | await self.app(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 79, in app
2024-04-29 00:55:07 | ERROR | stderr | | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-04-29 00:55:07 | ERROR | stderr | | raise exc
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-04-29 00:55:07 | ERROR | stderr | | await app(scope, receive, sender)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 77, in app
2024-04-29 00:55:07 | ERROR | stderr | | await response(scope, receive, send)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 264, in __call__
2024-04-29 00:55:07 | ERROR | stderr | | await wrap(partial(self.listen_for_disconnect, receive))
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 678, in __aexit__
2024-04-29 00:55:07 | ERROR | stderr | | raise BaseExceptionGroup(
2024-04-29 00:55:07 | ERROR | stderr | | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
2024-04-29 00:55:07 | ERROR | stderr | +-+---------------- 1 ----------------
2024-04-29 00:55:07 | ERROR | stderr | | Traceback (most recent call last):
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
2024-04-29 00:55:07 | ERROR | stderr | | yield
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 254, in __aiter__
2024-04-29 00:55:07 | ERROR | stderr | | async for part in self._httpcore_stream:
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 367, in __aiter__
2024-04-29 00:55:07 | ERROR | stderr | | raise exc from None
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 363, in __aiter__
2024-04-29 00:55:07 | ERROR | stderr | | async for part in self._stream:
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 349, in __aiter__
2024-04-29 00:55:07 | ERROR | stderr | | raise exc
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 341, in __aiter__
2024-04-29 00:55:07 | ERROR | stderr | | async for chunk in self._connection._receive_response_body(**kwargs):
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 210, in _receive_response_body
2024-04-29 00:55:07 | ERROR | stderr | | event = await self._receive_event(timeout=timeout)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http11.py", line 224, in _receive_event
2024-04-29 00:55:07 | ERROR | stderr | | data = await self._network_stream.read(
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 36, in read
2024-04-29 00:55:07 | ERROR | stderr | | return b""
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
2024-04-29 00:55:07 | ERROR | stderr | | self.gen.throw(typ, value, traceback)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
2024-04-29 00:55:07 | ERROR | stderr | | raise to_exc(exc) from exc
2024-04-29 00:55:07 | ERROR | stderr | | httpcore.ReadTimeout
2024-04-29 00:55:07 | ERROR | stderr | |
2024-04-29 00:55:07 | ERROR | stderr | | The above exception was the direct cause of the following exception:
2024-04-29 00:55:07 | ERROR | stderr | |
2024-04-29 00:55:07 | ERROR | stderr | | Traceback (most recent call last):
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 260, in wrap
2024-04-29 00:55:07 | ERROR | stderr | | await func()
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/starlette/responses.py", line 249, in stream_response
2024-04-29 00:55:07 | ERROR | stderr | | async for chunk in self.body_iterator:
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/fastchat/serve/openai_api_server.py", line 645, in generate_completion_stream_generator
2024-04-29 00:55:07 | ERROR | stderr | | async for content in generate_completion_stream(gen_params, worker_addr):
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/fastchat/serve/openai_api_server.py", line 694, in generate_completion_stream
2024-04-29 00:55:07 | ERROR | stderr | | async for raw_chunk in response.aiter_raw():
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpx/_models.py", line 987, in aiter_raw
2024-04-29 00:55:07 | ERROR | stderr | | async for raw_stream_bytes in self.stream:
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 149, in __aiter__
2024-04-29 00:55:07 | ERROR | stderr | | async for chunk in self._stream:
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 255, in __aiter__
2024-04-29 00:55:07 | ERROR | stderr | | yield part
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
2024-04-29 00:55:07 | ERROR | stderr | | self.gen.throw(typ, value, traceback)
2024-04-29 00:55:07 | ERROR | stderr | | File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
2024-04-29 00:55:07 | ERROR | stderr | | raise mapped_exc(message) from exc
2024-04-29 00:55:07 | ERROR | stderr | | httpx.ReadTimeout
2024-04-29 00:55:07 | ERROR | stderr | +------------------------------------
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with fastchat/serve/openai_api_server.py, especially generate_completion_stream_generator and generate_completion_stream, and trace the httpx streaming request shown in the stack trace. Reproduce the intermittent failure and determine the relevant timeout or disconnect behavior; done means the cause and an appropriate change or documented limitation are established with a regression test where feasible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100