Skip to content

πŸ› Fix: kb import deadlock problem - #3786

Open
cj2026-bit wants to merge 5 commits into
developfrom
cj/fix-kb-task-deadlock-delete
Open

πŸ› Fix: kb import deadlock problem#3786
cj2026-bit wants to merge 5 commits into
developfrom
cj/fix-kb-task-deadlock-delete

Conversation

@cj2026-bit

@cj2026-bit cj2026-bit commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Fix Celery Queue Starvation During Knowledge Base Ingestion

Problem

Large knowledge-base files could remain stuck in the ingesting state, and the data-processing service could appear to be hung.

The root cause was queue starvation:

  1. The forward parent task was executed on forward_q.
  2. It submitted multiple forward_part tasks and an aggregate_forward_parts callback.
  3. The parent task waited for the chord result.
  4. Before this fix, the child tasks and aggregation callback were also routed to forward_q.
  5. When all forward_q workers were occupied by waiting parent tasks, the child tasks could not start, causing a deadlock.

Solution

Processing stages are now isolated into dedicated Celery queues and Worker processes:

forward_q
    └── forward_part_q
            └── forward_aggregate_q

##Verification
Multiple files uploading at the same time, 2 types of files, 1 type has single-digit chunks, the other type has 2K chunks.
23bed5e6-d7bc-448c-96db-593ea1119803
aaeba8f2-7f62-411b-9ae0-43d7225e2427
After a while
0913940c-f329-4471-a6bf-15f56cd663ea
f6b7667b-320e-4496-9a4d-4b8b72b24802

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.

πŸ“’ Thoughts on this report? Let us know!

@cj2026-bit cj2026-bit self-assigned this Aug 26, 2026
@cj2026-bit cj2026-bit changed the title fix: isolate KB ingestion tasks and prevent delete resurrection fix: kb import deadlock problem Aug 26, 2026
@cj2026-bit cj2026-bit changed the title fix: kb import deadlock problem πŸ› Fix: kb import deadlock problem Aug 26, 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.

1 participant