Why Are All My Queue Jobs Stuck in “Pending” in Odoo?

Why Are All My Queue Jobs Stuck in “Pending” in Odoo?

If your queue jobs are stuck in the “Pending” state, it often points to a misconfiguration or conflict in your Odoo setup. This article walks you through the most common causes – including Docker-specific issues – and provides actionable solutions.

Common Reasons Queue Jobs Get Stuck

1. Odoo Not Properly Configured for Queue Job Module

The most frequent reason is an incomplete or incorrect setup of the Queue Job module.

Solution: ensure that your Odoo instance is configured correctly by following the How to install and configure VentorTech connector? .
Pay close attention to the “Installation” section, which covers necessary configuration steps.

2. Jobs Interrupted by Server Restart

Queue jobs that are in-progress when the Odoo server is restarted may remain stuck in the “Pending” or “Started” state.

Solution: follow this step-by-step recovery guide to clean up interrupted jobs:
How to automatically requeue stuck jobs in “Started” or “Enqueued” state?

3. Duplicate Job IDs from Multiple Odoo Databases

If you’ve duplicated your Odoo database (e.g., for testing or migration), you may have conflicting job IDs that cause the queue system to break.

Solution:

  • Remove unused or duplicate databases from your instance.

  • Or manually clear out duplicated jobs using Odoo shell or direct SQL cleanup.

More background on this issue: OCA Queue GitHub – Issue #153

Best Practice: Avoid running multiple Odoo databases on the same production instance.

4. Queue Jobs Not Running in Dockerized Odoo Setup

Running Odoo via official Docker images with PostgreSQL in a docker-compose setup introduces a special issue:

  • The Job Queue module includes a patch that only applies during Odoo’s initialization.

  • If the PostgreSQL database is not yet available at startup, this patch will silently fail.

Solution: Force Odoo to Wait for PostgreSQL. Add a wait-for-postgres.sh script to ensure Odoo waits for the DB before launching.

#!/bin/bash
set -e

# Set locale to avoid perl warnings
export LANG=C
export LC_ALL=C

# Default values
DB_HOST=${DB_HOST:-db}
DB_PORT=${DB_PORT:-5432}
MAX_RETRIES=30
RETRY_INTERVAL=2

echo "Waiting for PostgreSQL at $DB_HOST:$DB_PORT..."

# Wait for PostgreSQL to be ready
retry_count=0
while [ $retry_count -lt $MAX_RETRIES ]; do
    if pg_isready -h "$DB_HOST" -p "$DB_PORT" >/dev/null 2>&1; then
        echo "PostgreSQL is ready!"
        break
    else
        echo "PostgreSQL is not ready yet, waiting... (attempt $((retry_count + 1))/$MAX_RETRIES)"
    fi
    
    retry_count=$((retry_count + 1))
    
    if [ $retry_count -eq $MAX_RETRIES ]; then
        echo "ERROR: PostgreSQL did not become ready within $((MAX_RETRIES * RETRY_INTERVAL)) seconds"
        exit 1
    fi
    
    sleep $RETRY_INTERVAL
done

echo "PostgreSQL is ready! Starting Odoo..."

# Additional small delay to ensure everything is fully ready
sleep 3

# Execute the original command (Odoo)
exec "$@"

Then, in your docker-compose.yml, update the Odoo service command:

command: ["/wait-for-postgres.sh", "/usr/bin/odoo"] 

Don’t forget to pass the required environment variables (e.g., DB name, user, password).

Still Stuck? We Can Help

If none of the solutions above resolve your issue, reach out to our VentorTech Support Team
We’ll help you diagnose and fix the root cause of the job queue issue quickly.

Related Posts