odoo / odoo

Odoo. Open Source Apps To Grow Your Business.
https://www.odoo.com
Other
38.83k stars 25.18k forks source link

[12.0] could not obtain lock on row in relation "ir_cron" #48146

Closed m3asmi closed 4 years ago

m3asmi commented 4 years ago

Impacted versions: 12.0

In my postgresql log, I see following error (keeps on being logged over and over):

2020-03-21 13:30:02.825 UTC [14793] odoo@database ERROR:  could not obtain lock on row in relation "ir_cron"
2020-03-21 13:30:02.825 UTC [14793] odoo@database STATEMENT:  SELECT *
                                           FROM ir_cron
                                           WHERE numbercall != 0
                                              AND active
                                              AND nextcall <= (now() at time zone 'UTC')
                                              AND id=32
                                           FOR UPDATE NOWAIT
2020-03-21 13:30:31.314 UTC [14670] odoo@database LOG:  unexpected EOF on client connection with an open transaction
2020-03-21 13:30:31.314 UTC [14669] odoo@database LOG:  unexpected EOF on client connection with an open transaction
2020-03-21 13:30:31.314 UTC [14668] odoo@database LOG:  unexpected EOF on client connection with an open transaction
2020-03-21 13:33:30.233 UTC [15232] odoo@database_old ERROR:  could not obtain lock on row in relation "ir_cron"

What is causing this error?

I have following configuration: Odoo v12.0 Ubuntu 18.04.4 LTS

Potentially relevant parts of my config file:

limit_memory_hard = 26575110144 
limit_memory_soft = 22145925120 
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 170
limit_time_real_cron = -1
max_cron_threads = 10
workers = 30 
workers = 5
pedrobaeza commented 4 years ago

Sorry, this is not an Odoo issue, but a question on deployment. You should make it on Odoo official forums (https://www.odoo.com/forum/help-1) or mailing lists (https://odoo.com/groups), but not here.

Closing this by the reason above.

Yenthe666 commented 4 years ago

@pedrobaeza actually it tends to happen quite often in Odoo ;) Usually this happens if you have one cron job that cannot execute the job in time. The cron restarts and if another one is then running also you'll get a lock.

pedrobaeza commented 4 years ago

As said, a deployment question because you have one of the deployment parameters bad adjusted for that to happen.

m3asmi commented 4 years ago

@pedrobaeza @Yenthe666 indeed it was a programming error in a custom model in the scheduler. there they was so many connection without closing the cursor.

gnfranco commented 3 years ago

Even Baeza said, not my problem!! But the community still slow to solv it.

gnfranco commented 3 years ago

I have a odoo13 instance running on GCP with professional SQL managed by google, with lots of memory and intrastruture. But as I try to access the menu "Product", when it load the page crash my system and I have to restart odoo service.

pumppi commented 3 years ago

How did you solve this? With enterprise I get these errors. Without any custom modules.

filwu8 commented 2 years ago

;(1 + workers + max_cron_threads) * db_maxconn < max_connections workers = 0 max_cron_threads = 2 db_maxconn = 256 max_connections = 800

filwu8 commented 2 years ago

With this in mind:

1 worker is about 6 concurrent users.

ie: ALL clicking a button at the "exact same time".

Up to 99% of the time users read, type or scroll and that does not count as 'using' Odoo since no server resources are consumed. Only when a User or Visitor clicks a button, runs a report, imports data, etc. are server resources consumed.

filwu8 commented 2 years ago

1 worker could support 50 users or 100 users, depending on the scenario. 1 worker could support 10,000 an day or 5,000 an hour, depending on the scenario.