Skip to content

fix: raise gunicorn request line limit to keep tags API working with hundreds of knowledge bases - #7232

Closed
Jackkp0t wants to merge 1 commit into
1Panel-dev:v2from
Jackkp0t:fix/gunicorn-request-line-limit
Closed

Jackkp0t wants to merge 1 commit into
1Panel-dev:v2from
Jackkp0t:fix/gunicorn-request-line-limit

Conversation

@Jackkp0t

@Jackkp0t Jackkp0t commented Oct 7, 2026

Copy link
Copy Markdown

What

Set gunicorn --limit-request-line to 8190 bytes (the maximum it accepts) in apps/common/management/commands/services/services/gunicorn.py, instead of relying on the 4094-byte default.

Why

The search-document workflow node fetches its tag options on page load via

GET /workspace/<workspace_id>/knowledge/tags?knowledge_ids[]=<uuid>&knowledge_ids[]=<uuid>&...

(ui/src/workflow/nodes/search-document-node/index.vue watches knowledge_id_list and calls getAllTags with the node's full list; axios serializes the array as repeated knowledge_ids[]= params, which the backend reads via request.query_params.getlist('knowledge_ids[]').)

With hundreds of associated knowledge bases each knowledge_ids[]=<uuid> param adds ~58 bytes, so the request line reaches ~5,766 bytes at 100 ids. Production runs gunicorn (docker entrypoint python main.py start → GunicornService), whose default limit_request_line is 4094 bytes; over-limit request lines are answered with HTTP 400 (workers/base.py: handle_error maps LimitRequestLine to status_int = 400). The tag dropdown therefore shows 无数据 exactly as reported in #7199. Dev mode uses Django runserver, which has no such limit — which is why it doesn't reproduce locally.

8190 bytes covers ~140 knowledge base ids and also protects other legitimate long-GET endpoints.

How verified

  • Red/green against the real gunicorn 23.0.0 parser source (the pinned version, gunicorn/http/message.py + errors.py): with the default 4094, a 100-id request line (5,766 bytes) raises LimitRequestLine → HTTP 400 (Request Line is too large (5766 > 4094)); with 8190 the same request parses and yields all 100 params. Also verified at 140 ids / 8,046 bytes.
  • python -m py_compile passes; ruff check / ruff format --check findings on this file are byte-identical to the upstream baseline (pre-existing star-import F403/F405 and formatting), i.e. zero new findings from this change.

Closes #7199

@liuruibin

Copy link
Copy Markdown
Member

It can't solve the problem, it only delays it.

@liuruibin liuruibin closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 文档标签检索节点关联上百个知识库,刷新页面,获取不到标签信息

2 participants