Skip to content Skip to sidebar Skip to footer

ERROR: could not obtain lock on row in relation "ir_cron"

On September 28th i'm encountering an error message when accessing postgresql log. The message appear to be like this one :

ERROR: could not obtain lock on row in relation "ir_cron"
2020-09-28 06:25:35.787 WITA [61738] odrmt@database STATEMENT: SELECT * FROM ir_cron WHERE numbercall != 0 AND active AND nextcall <= (now() at time zone 'UTC') AND id=14 FOR UPDATE NOWAIT
After doing some research, as mentioned here on github the problem are caused by cron job that can't handle or execute the job in time. The cron restarts and if another one is running then it will lock (causing a long time loading until one is done)


The solution is editing odoo-server.conf file in /etc/odoo-server.conf and change max_cron_threads to "1" value so "the handler" of the job is only one to avoid this kind of lock in near future.

max_cron_threads parameter