Skip to content

[bug] nginx频繁报超时504错误 #3882

Description

@AHHH32

Before you start

  • I searched existing issues and this is not a duplicate.
  • I can reproduce this on the latest main.

Problem summary

worker=1的情况下,频繁触发nginx超时,而gateway服务并没用报错

Affected area(s)

Backend API (gateway / endpoints / SSE)

What happened?

  1. 使用make up部署。
  2. 使用postgre数据库存储用户等数据。
  3. 然后就有很大的频率触发504超时错误,主要的接口是:/api/v1/auth/register,/api/v1/auth/login/local,GET /api/agents/my-agent-name

不知道什么情况下触发的,无法定位错误原因。

Expected behavior

不应该超时。

Steps to reproduce

  1. 正常配置
  2. 使用postgre数据库存储用户数据等。
  3. make up

Relevant logs

## nginx log
172.18.0.1 - - [29/Jun/2026:10:30:04 +0000] "POST /api/langgraph/threads/2816129c-6bf0-48f1-a113-a3eb70621d2c/runs/stream HTTP/1.1" 200 1077437 "http://localhost:2027/workspace/chats/2816129c-6bf0-48f1-a113-a3eb70621d2c" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.124.2 Chrome/148.0.7778.97 Electron/42.2.0 Safari/537.36"
172.18.0.1 - - [29/Jun/2026:10:30:04 +0000] "POST /api/langgraph/threads/2816129c-6bf0-48f1-a113-a3eb70621d2c/history HTTP/1.1" 200 27750 "http://localhost:2027/workspace/chats/2816129c-6bf0-48f1-a113-a3eb70621d2c" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.124.2 Chrome/148.0.7778.97 Electron/42.2.0 Safari/537.36"
172.18.0.1 - - [29/Jun/2026:10:30:04 +0000] "GET /api/threads/2816129c-6bf0-48f1-a113-a3eb70621d2c/token-usage HTTP/1.1" 200 261 "http://localhost:2027/workspace/chats/2816129c-6bf0-48f1-a113-a3eb70621d2c" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.124.2 Chrome/148.0.7778.97 Electron/42.2.0 Safari/537.36"
172.18.0.1 - - [29/Jun/2026:10:30:04 +0000] "POST /api/langgraph/threads/search HTTP/1.1" 200 490 "http://localhost:2027/workspace/chats/2816129c-6bf0-48f1-a113-a3eb70621d2c" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.124.2 Chrome/148.0.7778.97 Electron/42.2.0 Safari/537.36"
172.18.0.1 - - [29/Jun/2026:10:30:06 +0000] "POST /api/threads/2816129c-6bf0-48f1-a113-a3eb70621d2c/suggestions HTTP/1.1" 200 149"http://localhost:2027/workspace/chats/2816129c-6bf0-48f1-a113-a3eb70621d2c" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.124.2 Chrome/148.0.7778.97 Electron/42.2.0 Safari/537.36"
2026/06/30 02:02:20 [error] 8#8: *71 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 172.18.0.1, server: _, request: "GET /api/skills HTTP/1.1", upstream: "http://172.18.0.3:8001/api/skills", host: "localhost:2027", referrer: "http://localhost:2027/workspace/chats/2816129c-6bf0-48f1-a113-a3eb70621d2c"
172.18.0.1 - - [30/Jun/2026:02:02:20 +0000] "GET /api/skills HTTP/1.1" 504 569 "http://localhost:2027/workspace/chats/2816129c-6bf0-48f1-a113-a3eb70621d2c" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.124.2 Chrome/148.0.7778.97 Electron/42.2.0 Safari/537.36"
2026/06/30 02:52:31 [error] 8#8: *74 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 192.168.0.17, server: _, request: "POST /api/v1/auth/login/local HTTP/1.1", upstream: "http://172.18.0.3:8001/api/v1/auth/login/local", host: "10.7.0.204:2026"
192.168.0.17 - - [30/Jun/2026:02:52:31 +0000] "POST /api/v1/auth/login/local HTTP/1.1" 504 167 "-" "okhttp/3.14.9"
192.168.0.17 - - [30/Jun/2026:02:52:31 +0000] "POST /api/v1/auth/login/local HTTP/1.1" 200 41 "-" "okhttp/3.14.9"
192.168.0.17 - - [30/Jun/2026:02:52:31 +0000] "GET /api/agents/czgj-parent-agent-333 HTTP/1.1" 200 4129 "-" "okhttp/3.14.9"
2026/06/30 02:53:31 [error] 8#8: *74 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 192.168.0.17, server: _, request: "POST /api/v1/auth/register HTTP/1.1", upstream: "http://172.18.0.3:8001/api/v1/auth/register", host: "10.7.0.204:2026"


## gateway log

[2026-06-30 10:52:31 CST] [TraceId:LppzxyI0] [uvicorn.access] [INFO] 172.18.0.4:58120 - "POST /api/v1/auth/login/local HTTP/1.1" 200
[2026-06-30 10:52:31 CST] [TraceId:4XIYsUP9] [uvicorn.access] [INFO] 172.18.0.4:58134 - "GET /api/agents/czgj-parent-agent-333 HTTP/1.1" 200
[2026-06-30 10:53:31 CST] [TraceId:hZDyppuK] [uvicorn.access] [INFO] 172.18.0.4:36988 - "POST /api/v1/auth/login/local HTTP/1.1" 200
[2026-06-30 10:53:31 CST] [TraceId:qiaNDJ8o] [uvicorn.access] [INFO] 172.18.0.4:36990 - "POST /api/agents HTTP/1.1" 409
[2026-06-30 10:53:31 CST] [TraceId:IpSbugPG] [uvicorn.access] [INFO] 172.18.0.4:36998 - "POST /api/v1/auth/login/local HTTP/1.1" 200
[2026-06-30 10:53:31 CST] [TraceId:dIlCrLXt] [app.gateway.routers.threads] [INFO] Thread created: ecd19343-ab86-402b-a0c2-5b9081123521
[2026-06-30 10:53:31 CST] [TraceId:dIlCrLXt] [uvicorn.access] [INFO] 172.18.0.4:37010 - "POST /api/threads HTTP/1.1" 200
[2026-06-30 10:53:31 CST] [TraceId:Yo5o21_3] [deerflow.runtime.runs.manager] [INFO] Run created: run_id=daef066f-49b7-4ced-bd00-2baeb7070e5f thread_id=ecd19343-ab86-402b-a0c2-5b90811c6103
[2026-06-30 10:53:31 CST] [TraceId:Yo5o21_3] [deerflow.runtime.runs.worker] [INFO] Run daef066f-49b7-4ced-bd00-2baeb7070e5f: 'events' stream_mode not supported in gateway (requires astream_events + checkpoint callbacks). Skipping.
[2026-06-30 10:53:31 CST] [TraceId:Yo5o21_3] [uvicorn.access] [INFO] 172.18.0.4:37012 - "POST /api/threads/ecd19343-ab86-402b-a0c2-5b90811c6103/runs/stream HTTP/1.1" 200
[2026-06-30 10:53:31 CST] [TraceId:Yo5o21_3] [deerflow.runtime.runs.manager] [INFO] Run daef066f-49b7-4ced-bd00-2baeb7070e5f -> running
[2026-06-30 10:53:31 CST] [TraceId:Yo5o21_3] [deerflow.agents.lead_agent.agent] [INFO] Create Agent(czgj-parent-agent-333) -> thinking_enabled: True, reasoning_effort: minimal, model_name: doubao-seed-1-0-lite, is_plan_mode: True, subagent_enabled: False, max_concurrent_subagents: 3
[2026-06-30 10:53:31 CST] [TraceId:Yo5o21_3] [deerflow.tools.tools] [INFO] Including view_image_tool for model 'doubao-seed-2-0-lite' (supports_vision=True)
[2026-06-30 10:53:31 CST] [TraceId:Yo5o21_3] [deerflow.tools.tools] [INFO] Total tools loaded: 8, built-in tools: 3, MCP tools: 0, ACP tools: 0

How are you running DeerFlow?

Other

Operating system

Linux

Platform details

No response

Python version

No response

Node.js version

No response

pnpm version

No response

uv version

No response

Git state

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Major priorityarea:backendGateway / runtime / core backend under backend/bugSomething isn't workingneeds-validationTouches front/back contract surface; needs real-path validation

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions