Error Diagnostics // NodeFlow Diagnostics
Langflow Celery Worker Hang & Prefork RSS Retention
Langflow prefork Celery workers accumulate C-extension memory from PyMuPDF, Unstructured, and embedding tokenizers until workers deadlock or stall queue consumption.
Measured Stack Telemetry & Memory Profile
Unlike Node.js garbage collection, Python prefork workers rarely return fragmented C-heap pages to Linux after processing large PDFs. Without --max-tasks-per-child recycling and concurrency caps matching vCPU cores, workers silently hang while Redis queues back up.
| Subsystem / Signal | Measured Target | Operational Impact |
|---|---|---|
| Unrecycled Worker RSS Growth | +350 - 900 MB / 25 tasks | Eventually hits container cgroup ceiling |
| Safe --max-tasks-per-child | 25 - 50 tasks | Forces clean worker respawn and RSS release |
| Recommended KVM 4/8 Concurrency | 2 - 6 workers | 1-1.5 workers per physical/vCPU core |
Step-by-Step Triage & Config Remediation
- Add --max-tasks-per-child=50: Configure Celery worker startup command to recycle worker processes every 25-50 tasks.
- Cap worker concurrency to vCPU count: Set --concurrency=2 on KVM 2 or --concurrency=4 on KVM 4 to stop context-switch thrashing.
- Pin dedicated Redis result TTL: Enable Redis maxmemory 1024mb and clean stale task results so broker RAM stays bounded.
command: celery -A langflow.worker worker --concurrency=4 --max-tasks-per-child=50 # .env: LANGFLOW_WORKER_TIMEOUT=300
Diagnostic FAQ
Why do Langflow tasks sit in PENDING forever?
Usually the Celery worker died from OOM without notifying Redis, or concurrency exceeds available RAM/CPU cores.
Should I run Langflow Celery on a 4 GB VPS?
No. Langflow + Postgres + Redis + Celery requires at least 8 GB (KVM 2) for light flows and 16 GB (KVM 4) for vector ingestion.