Skip to content

Queue Job tasks stuck in "pending" state in Docker Swarm with multiple nodes (Odoo 17) #747

Closed

Description

@PierreAlainKouakou

🚨 Queue Job tasks stuck in "pending" state in Docker Swarm with multiple nodes (Odoo 17)

Module

queue_job

Describe the bug

In a Docker Swarm environment with three nodes, one Odoo instance, Pgpool, and Traefik, asynchronous tasks remain stuck in the pending state in the queue. Even after a requeue, they are not processed. The only way to restart task processing is to restart the Odoo service, which sometimes results in task duplication.

This issue does not occur in a Docker Compose environment with a single host, where tasks are processed normally after configuring the workers.

To Reproduce

Affected versions: Odoo 17, queue_job v17

Steps to reproduce the issue:

  1. Deploy Odoo 17 with queue_job in a Docker Swarm environment with three nodes, a Pgpool instance, and a Traefik reverse proxy.
  2. Configure Odoo workers and queue_job with defined channels.
  3. Trigger an asynchronous task.
  4. Observe that the task remains in the pending state and is never processed, even after a requeue.
  5. Restart the Odoo service. At this point, some tasks are eventually executed, but sometimes duplicated.

Expected behavior

Pending (pending) tasks should be processed by the workers without requiring an Odoo restart and without the risk of duplication.

Additional context

Docker Compose Environment (Working Fine):

  • Infrastructure: 1 host
  • Resources: 4 CPU, 32 GB RAM
  • Workers: workers=6
  • Queue Job Channels: ODOO_QUEUE_JOB_CHANNELS: root:2,enrollment:2,notification:2

Docker Swarm Environment (Problematic):

  • Infrastructure: 3 nodes (each with 4 CPU, 32 GB RAM)
  • Workers: workers=10
  • Queue Job Channels: ODOO_QUEUE_JOB_CHANNELS: root:4,enrollment:4,notification:2
  • Load Balancing & Proxy: Using Pgpool and Traefik

Logs & Debugging:

  • Logs show that tasks are correctly added to the queue, but no worker processes them.
  • Enabling log-handler=queue_job:DEBUG did not provide any conclusive insights.

Any help or debugging suggestions would be greatly appreciated! 🚀

Activity

  1. sbidoul commented on Mar 4, 2025

    @sbidoul
    Member

    You need to start with --load=web,queue_job in exactly one1 container.

    Footnotes

    1. when https://github.com/OCA/queue/pull/668 is merged, queue_job can be loaded on all containers ↩

  2. PierreAlainKouakou commented on Mar 6, 2025

    @PierreAlainKouakou
    Author

    Thanks @sbidoul for your detailed response!

    Indeed, these improvements would be very useful in a multi-container environment. However, in my case, I'm running a single Odoo instance in a Docker Swarm environment, so the current constraint is not really an issue for me.

    By the way, do you know why PR #668 hasn't been merged yet, even though this feature seems valuable for many use cases? Are there any technical blockers or ongoing discussions about it?

  3. sbidoul commented on Mar 6, 2025

    @sbidoul
    Member

    do you know why #668 hasn't been merged yet

    It will be merged soon, I think

  4. PierreAlainKouakou commented on Mar 6, 2025

    @PierreAlainKouakou
    Author

    Thanks for your reply @sbidoul ! That’s great to hear. Looking forward to seeing it merged soon! 🚀

  5. sbidoul commented on Mar 6, 2025

    @sbidoul
    Member

    👍 Feel free to close this issue when it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions