queue icon indicating copy to clipboard operation
queue copied to clipboard

queue_job: concurrent update exception on job state update

Open gurneyalex opened this issue 2 months ago • 0 comments

On a production instance, I sometimes experience concurrent update exceptions on setting a job to done. This happens for a job which is part of group of N1 jobs, chained with a single job, chained with a second group of N2 jobs.and that job is always the last job of the first group. The jobs of the first and second group are run in parallel.

The exception I get:

ERROR odoodb odoo.sql_db: bad query: b' UPDATE "queue_job"
                    SET "date_done" = "__tmp"."date_done"::timestamp, "dependencies" = "__tmp"."dependencies"::text, "exec_time" = "__tmp"."exec_time"::double precision, "result" = "__tmp"."result"::text, "retry" = "__tmp"."retry"::int4, "state" = "__tmp"."state"::VARCHAR
                   FROM (VALUES (274978316, \'2025-12-01 15:48:53.476526\', \'{"depends_on": [], "reverse_depends_on": ["abca0f33-26d2-408d-ae2a-f35f62c12844"]}\', 930.537869, NULL, 3, \'done\')) AS "__tmp"("id", "date_done", "dependencies", "exec_time", "result", "retry", "state")
                    WHERE "queue_job"."id" = "__tmp"."id"
               '
ERROR: could not serialize access due to concurrent update

In this case the abca0f33-26d2-408d-ae2a-f35f62c12844 UUID is the UUID of the single job in the middle of the dependency chain, and 274978316 is the ID of the last job to run in the first group.

This happens on a database running Odoo 18.0, the source code of OCA/queue is up to date.

When I get there, the job restarts. If I stop the instance and restart it, the job finally terminates.

gurneyalex avatar Dec 01 '25 16:12 gurneyalex