Skip to Content
Menu
This question has been flagged
2 Replies
8891 Views

Why is odoo 11 closing the database connection (or why is it gone)

We have script which is runing for a longer period ( > 30 minutes) however everytime the script runs, it is killed between 10 and 30 minutes because the database connection is closed (or cleanup). See logging below.

What can be the cause the the connection with the postgresql 12.5 is lost/closed

Both Odoo and postgresql are running on the same server: Ubuntu 18.04

Odoo logging:

2020-01-31 12:30:19,763 14855 INFO ? odoo.sql_db: ConnectionPool(used=1/count=1/max=640): Closed 5 connections to 'user=odoo sslmode=prefer dbname=backup-2020-01-30'

2020-01-31 12:30:19,827 14855 INFO ? werkzeug: 127.0.0.1 - - [31/Jan/2020 12:30:19] "GET /web/database/selector HTTP/1.1" 200 -
2020-01-31 12:30:20,007 14855 ERROR backup-2020-01-30 odoo.sql_db: bad query: b'SELECT DISTINCT product_tmpl_id FROM product_product WHERE id IN (2392)'
ERROR: cursor already closed
2020-01-31 12:30:20,375 14855 ERROR backup-2020-01-30 odoo.sql_db: bad query: b'SELECT DISTINCT product_tmpl_id FROM product_product WHERE id IN (2392)'
ERROR: cursor already closed
2020-01-31 12:30:20,376 14855 ERROR backup-2020-01-30 odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/var/lib/odoo/odoo/http.py", line 646, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/var/lib/odoo/odoo/http.py", line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/var/lib/odoo/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/var/lib/odoo/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/var/lib/odoo/odoo/http.py", line 339, in _call_function
return checked_call(self.db, *args, **kwargs)





Avatar
Discard

Hello sir, did you get any solution ?

Author Best Answer

Dear Khalid, 

Not really, but found a terrible work around:

I comment close connection in  sql_db.py and stop and restart odoo

#terrible fix

#cnx.close()


Avatar
Discard
Best Answer

Dear Jurn,

Please increase the CPU time limit of Odoo config .

Odoo's config file needs to be modified to increase the CPU time limit. It is set to 600 by default(10 minutes )  Limit_time_cpu=600 or something similar.

Thank you 
Dharmesh

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 23
4328
1
Mar 15
4035
0
Jun 24
325
0
May 24
217
1
Jun 24
644