Missing Locks
Error Message
What It Means
This error occurs when a job being processed by a worker unexpectedly loses its “lock.”When a worker processes a job, it requires a special lock key to ensure the job is currently “owned” by that worker. This prevents other workers from picking up the same job.
Common Causes
High CPU Usage
High CPU Usage
Problem: The worker is consuming too much CPU and has no time to renew the lock every 30 seconds (default expiration time).Solution:
- Reduce worker concurrency
- Optimize job processing code
- Move CPU-intensive work to separate processes
- Monitor worker CPU usage
Redis Connection Lost
Redis Connection Lost
Problem: The worker lost communication with Redis and cannot renew the lock in time.Solution:
- Check network stability between worker and Redis
- Implement proper connection retry logic
- Monitor Redis connection health
- Consider increasing lock renewal interval
Job Forcefully Removed
Job Forcefully Removed
Problem: The job was forcefully removed using BullMQ’s APIs or by removing the entire queue.Solution:
- Avoid removing jobs that are currently being processed
- Use proper job state checks before removal
- Implement graceful job cancellation
Wrong maxmemory-policy
Wrong maxmemory-policy
Problem: Redis instance has wrong
maxmemory-policy setting. It should be noeviction to avoid Redis removing lock keys before expiration.Solution:- Set
maxmemory-policytonoevictionin Redis config - See Going to Production for details
Invalid or Undefined Environment Variables
Error Message
What It Means
This error typically happens when a parameter passed into a Redis command ends up being something other than a valid string or number.Common Causes
If you rely on environment variables (e.g., for queue names or job data), this error can occur when those variables are:- Undefined (not set at all)
- Empty strings (i.e.,
"") - Non-string values (e.g., objects or arrays)
Solutions
Validate Environment Variables Early
Check all required environment variables during initialization:This ensures you fail fast if a variable isn’t set, instead of causing hidden Lua script errors.
Example: Robust Configuration
Job Stuck in Active State
Symptoms
- Jobs remain in “active” state indefinitely
- Jobs are not being processed
- No error messages in logs
Solutions
Worker Not Running
Worker Not Running
Ensure workers are running and connected:
Job Processor Hanging
Job Processor Hanging
Make sure job processors complete or throw errors:
Stalled Job Check
Stalled Job Check
Jobs should automatically become stalled after 30 seconds. Check stalled jobs:
Memory Issues
Symptoms
- Redis running out of memory
- Jobs disappearing
- “OOM command not allowed” errors
Solutions
Connection Issues
Symptoms
- “ECONNREFUSED” errors
- Workers not picking up jobs
- Intermittent failures
Solutions
- Check Redis Connection
- Configure Retry Strategy
- Check Network Connectivity
Performance Issues
Jobs Processing Slowly
Increase Concurrency
Add More Workers
Scale horizontally by running multiple worker instances
Optimize Job Processing
Profile and optimize slow job processors
Use Redis Cluster
Distribute load across multiple Redis nodes
Debugging Tips
Related Resources
Going to Production
Production deployment best practices
Redis Configuration
Redis compatibility and configuration
