Fix Guides // NodeFlow Diagnostics
Recycling Langflow Celery Workers to Prevent Hangs & RSS Leaks
Adding --max-tasks-per-child=50 and strict concurrency bounds stops Langflow Celery workers from leaking C-extension PDF parser memory indefinitely.
Measured Stack Telemetry & Memory Profile
Because Python document loaders hold fragmented memory across runs, restarting each child worker after 50 completed flows returns 100% of leaked RSS to the Linux kernel with zero Redis queue loss.
| Subsystem / Signal | Measured Target | Operational Impact |
|---|---|---|
| max-tasks-per-child | 50 tasks | Caps per-worker RSS drift under 1.2 GB |
| Celery Timeout Window | 300 seconds | Terminates wedged external HTTP tool calls |
| Recommended Host Tier | KVM 4 (16 GB) / KVM 8 (32 GB) | Clean separation of web, Celery, Redis, Postgres |
Step-by-Step Triage & Config Remediation
- Enable LANGFLOW_CELERY_ENABLED=true: Point CELERY_BROKER_URL and CELERY_RESULT_BACKEND to your local Redis container.
- Enforce --max-tasks-per-child=50: Pass the flag directly in the langflow-celery Docker command.
- Set LANGFLOW_WORKER_TIMEOUT=300: Prevent stalled third-party API calls from locking worker slots forever.
LANGFLOW_CELERY_ENABLED=true CELERY_BROKER_URL=redis://redis:6379/0 CELERY_RESULT_BACKEND=redis://redis:6379/1 LANGFLOW_WORKER_TIMEOUT=300
Diagnostic FAQ
Does worker recycling drop active tasks?
No. Celery only respawns a child process after its current task finishes and acknowledges Redis.
Why not set --concurrency=16 on a 4-vCPU VPS?
Excessive prefork workers multiply baseline Python RSS by 16x and cause instant thrashing.