Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read) #3898

Closed
oymclihui opened this issue Apr 26, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@oymclihui
Copy link

D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\torch_utils.py:831: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
return self.fget.get(instance, owner)()
2024-04-26 16:03:56,433 - embeddings_api.py[line:39] - ERROR: Repo id must use alphanumeric chars or '-', '_', '.', '--' and '..' are forbidden, '-' and '.' cannot start or end the name, max length is 96: 'D:\chatglm_ai\Langchain-Chatchat\models\bge-large-zh-v1.5'.
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 269, in call
await wrap(partial(self.listen_for_disconnect, receive))
File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 258, in wrap
await func()
File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 215, in listen_for_disconnect
message = await receive()
^^^^^^^^^^^^^^^
File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 535, in receive
await self.message_event.wait()
File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\asyncio\locks.py", line 213, in wait
await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 1e0781cd090

During handling of the above exception, another exception occurred:

  • Exception Group Traceback (most recent call last):
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 407, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 69, in call
    | return await self.app(scope, receive, send)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\fastapi\applications.py", line 1054, in call
    | await super().call(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\applications.py", line 119, in call
    | await self.middleware_stack(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\errors.py", line 186, in call
    | raise exc
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\errors.py", line 164, in call
    | await self.app(scope, receive, _send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\cors.py", line 83, in call
    | await self.app(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call
    | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
    | raise exc
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    | await app(scope, receive, sender)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 762, in call
    | await self.middleware_stack(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 782, in app
    | await route.handle(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 297, in handle
    | await self.app(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 77, in app
    | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
    | raise exc
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
    | await app(scope, receive, sender)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\routing.py", line 75, in app
    | await response(scope, receive, send)
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 255, in call
    | async with anyio.create_task_group() as task_group:
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio_backends_asyncio.py", line 678, in aexit
    | raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 258, in wrap
    | await func()
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\sse_starlette\sse.py", line 245, in stream_response
    | async for data in self.body_iterator:
    | File "D:\chatglm_ai\Langchain-Chatchat\server\chat\knowledge_base_chat.py", line 81, in knowledge_base_chat_iterator
    | docs = await run_in_threadpool(search_docs,
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\starlette\concurrency.py", line 40, in run_in_threadpool
    | return await anyio.to_thread.run_sync(func, *args)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    | return await get_async_backend().run_sync_in_worker_thread(
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio_backends_asyncio.py", line 2144, in run_sync_in_worker_thread
    | return await future
    | ^^^^^^^^^^^^
    | File "D:\ProgramData\anaconda3\envs\langchainChatchat\Lib\site-packages\anyio_backends_asyncio.py", line 851, in run
    | result = context.run(func, *args)
    | ^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_doc_api.py", line 38, in search_docs
    | docs = kb.search_docs(query, top_k, score_threshold)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_service\base.py", line 182, in search_docs
    | docs = self.do_search(query, top_k, score_threshold)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_service\faiss_kb_service.py", line 66, in do_search
    | embeddings = embed_func.embed_query(query)
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | File "D:\chatglm_ai\Langchain-Chatchat\server\knowledge_base\kb_service\base.py", line 443, in embed_query
    | query_embed = embeddings[0]
    | ~~~~~~~~~~^^^
    | TypeError: 'NoneType' object is not subscriptable
    +------------------------------------
    2024-04-26 16:03:56,467 - utils.py[line:197] - ERROR: RemoteProtocolError: API通信遇到错误:peer closed connection without sending complete message body (incomplete chunked read)
@oymclihui oymclihui added the bug Something isn't working label Apr 26, 2024
Copy link

dosubot bot commented Apr 26, 2024

To address the issues you're encountering, here are targeted solutions:

  1. API Communication Error ("peer closed connection without sending complete message body"): Implement retry logic for your API requests to handle intermittent network issues. Use libraries like httpx with a retry mechanism to automatically retry failed requests.

  2. "TypedStorage is deprecated" Warning: Update your PyTorch code to use the latest APIs. Replace TypedStorage usage with the recommended tensor.untyped_storage() or update to the latest version of PyTorch and adjust your code according to the new API guidelines.

  3. Repo ID Format Error: Ensure your repo id matches the required format using a regular expression that allows only alphanumeric characters and specific symbols. Adjust your validation logic to match these requirements closely.

  4. NoneType Object Error During Document Search: Before proceeding with operations on the response from your document search, verify that the response is not None. Implement checks to handle cases where the response might be empty or not as expected.

For the ExceptionGroup error related to unhandled errors in a TaskGroup, ensure all asynchronous tasks within the TaskGroup have proper exception handling. This involves wrapping task operations in try-except blocks to catch and manage exceptions locally within tasks, preventing unhandled exceptions from escalating.

These solutions are designed to directly address the specific errors in your application, focusing on practical steps and adjustments. For the PyTorch deprecation warning and other library-specific issues, consulting the official documentation or community forums can provide additional insights and examples tailored to the latest versions.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants