-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
"Server is busy" caused by slow build of flow. #3878
Comments
Hey @9n! 👋 I'm here to help you with any bugs, questions, or contributions. Let's tackle this together! To resolve the "Server is busy" issue caused by a slow build of flow in versions 1.0.17 and 1.0.18, you can modify the asynchronous task creation in the Langflow repository. Your proposed modification to the asynchronous task creation is incorrect because The original implementation is appropriate for non-blocking behavior in an ASGI context: build_task = asyncio.create_task(await asyncio.to_thread(_build_vertex, vertex_id, graph, event_manager)) This code correctly runs the Additionally, starting from version 0.5, Langflow introduces the Example API request with the curl -X POST \
http://localhost:3000/api/v1/process/<your_flow_id> \
-H 'Content-Type: application/json' \
-H 'x-api-key: <your_api_key>' \
-d '{"inputs": {"text": ""}, "tweaks": {}, "sync": false}' You can check the status of an asynchronous task by making a GET request to the curl -X GET \
http://localhost:3000/api/v1/task/<task_id> \
-H 'x-api-key: <your_api_key>' This modification ensures that if the task fails to run in Celery, it will fall back to running the task locally, which can help mitigate the "Server is busy" issue [1][2]. |
I have checked this issue out carefully, and I'm pretty sure it DOES exist. There is a easy way to reproduce it:
In v1.0.18, there is a optimization in frontend that do not check health when running a build, so that window 1 will not popup And code below should fix the issue, I have tried: |
A slow flow build will block the entire server, I experienced this issue in 1.0.17 and 1.0.18.
I notice an similar issue #3812 was fixed in 1.0.18, but I can't find out which commit fixed #3812 (maybe the eventmanager?), and I think this is a different one.
By digging into the code, I find below code try to run build in a dedicated thread to void blocking the entire asgi server:
langflow/src/backend/base/langflow/api/v1/chat.py
Line 327 in 1caba1c
I think it should be
build_task = asyncio.create_task(asyncio.to_thread(asyncio.run, _build_vertex(vertex_id, graph, event_manager)))
. Because_build_vertex
is async.I'm new to python, am I missing something?
The text was updated successfully, but these errors were encountered: