Closed SwordHG closed 6 months ago
The error you're encountering is due to asyncio tasks being attached to a different event loop than the one currently running. This is a common issue when there's a mismatch between the event loop used by FastAPI/Uvicorn and other asyncio tasks or background tasks in your application. Here are steps to address this:
asyncio.set_event_loop(new_loop)
to set the newly created loop as the current event loop before scheduling tasks on it.--workers
argument to specify the number of worker processes.For more detailed guidance, refer to the FastAPI documentation and the Uvicorn documentation. This approach should help you resolve the issue and scale your application to handle the desired load.
已解决,设置并发数就能解决
已解决,设置并发数就能解决
你好,请问能详细描述一下解决方案吗?我通过增大args.limit_worker_concurrency
的设置方法还是会遇到上述问题,并发数超过5个后,就会报got Future <Future pending> attached to a different loop
的问题
已解决,设置并发数就能解决
你好,请问能详细描述一下解决方案吗?我通过增大
args.limit_worker_concurrency
的设置方法还是会遇到上述问题,并发数超过5个后,就会报got Future <Future pending> attached to a different loop
的问题
那你的问题和我应该不一样
那你的问题和我应该不一样
因为我也是调用zhipu-api
的在线接口,但超过5个并发数量后也会出现跟你的issue描述中一样的报错信息。
那请问你的解决方案是什么呢?就是像我描述的增大args.limit_worker_concurrency
(初始默认值是5
)后就解决了并发数量的问题吗?
那你的问题和我应该不一样
因为我也是调用
zhipu-api
的在线接口,但超过5个并发数量后也会出现跟你的issue描述中一样的报错信息。那请问你的解决方案是什么呢?就是像我描述的增大
args.limit_worker_concurrency
(初始默认值是5
)后就解决了并发数量的问题吗?
已解决。
因为我们团队有一个魔改版的Langchain-Chatchat
,删减&增加了很多功能、调整了大部分的代码结构,故在处理API ModelWorker
的时候,args.limit_worker_concurrency
没有正确读取到配置文件中的参数设置。
修改后压力测试没有问题。
那你的问题和我应该不一样
因为我也是调用
zhipu-api
的在线接口,但超过5个并发数量后也会出现跟你的issue描述中一样的报错信息。 那请问你的解决方案是什么呢?就是像我描述的增大args.limit_worker_concurrency
(初始默认值是5
)后就解决了并发数量的问题吗?已解决。
因为我们团队有一个魔改版的
Langchain-Chatchat
,删减&增加了很多功能、调整了大部分的代码结构,故在处理API ModelWorker
的时候,args.limit_worker_concurrency
没有正确读取到配置文件中的参数设置。修改后压力测试没有问题。
原来是自己挖的坑,互换个联系方式吧
可以一起沟通一下吗
版本是0.29版本 调用的是在线的qwen-turbo 基于知识的问答,当并发大于5的时候,报错 ERROR: Exception in ASGI application Traceback (most recent call last): File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi result = await app( # type: ignore[func-returns-value] File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/applications.py", line 116, in call await self.middleware_stack(scope, receive, send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/middleware/errors.py", line 186, in call raise exc File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/middleware/errors.py", line 164, in call await self.app(scope, receive, _send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app raise exc File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app await app(scope, receive, sender) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/routing.py", line 746, in call await route.handle(scope, receive, send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/routing.py", line 288, in handle await self.app(scope, receive, send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/routing.py", line 75, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/_exception_handler.py", line 55, in wrapped_app raise exc File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/_exception_handler.py", line 44, in wrapped_app await app(scope, receive, sender) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/starlette/routing.py", line 70, in app response = await func(request) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/fastapi/routing.py", line 299, in app raise e File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/fastapi/routing.py", line 294, in app raw_response = await run_endpoint_function( File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(**values) File "/data/zhouyj/IntQA/env/lib/python3.9/site-packages/fastchat/serve/base_model_worker.py", line 196, in api_generate_stream await acquire_worker_semaphore() File "/usr/local/python3.9/lib/python3.9/asyncio/locks.py", line 417, in acquire await fut RuntimeError: Task <Task pending name='Task-820' coro=<RequestResponseCycle.run_asgi() running at /data/zhouyj/IntQA/env/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py:419> cb=[set.discard()]> got Future attached to a different loop
2024-04-12 14:56:25 | INFO | httpx | HTTP Request: POST http://127.0.0.1:21006/worker_generate_stream "HTTP/1.1 500 Internal Server Error"
这个问题怎么解决,现在qwen-turbo支持qpm为500,想要支持qpm500的并发