This question has been flagged
7 Replies
23696 Views

I have Odoo 9 with postgreSQL 9.6, with nginx and the longpolling well configured.

Everything is working fine, and suddenly, the server crashes and this message appears in the log:

OperationalError: FATAL:  sorry, too many clients already
2018-05-16 13:00:02,496 141 INFO ? openerp.sql_db: Connection to the database failed
2018-05-16 13:00:02,496 141 ERROR ? openerp.service.server: Worker (141) Exception occured, exiting...
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/openerp/service/server.py", line 721, in run
    self.process_work()
  File "/usr/lib/python2.7/dist-packages/openerp/service/server.py", line 790, in process_work
    db_names = self._db_list()
  File "/usr/lib/python2.7/dist-packages/openerp/service/server.py", line 783, in _db_list
    db_names = openerp.service.db.list_dbs(True)
  File "/usr/lib/python2.7/dist-packages/openerp/service/db.py", line 323, in list_dbs
    with closing(db.cursor()) as cr:
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 643, in cursor
    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 177, in __init__
    self._cnx = pool.borrow(dsn)
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 526, in _locked
    return fun(self, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/openerp/sql_db.py", line 594, in borrow
    **connection_info)
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)


I have to restart the server to temporal fix, but I don't know what is the cause.

I have a 4 cores CPU with 8 GB RAM.

I set these parameters in Odoo.conf file:

...
workers = 7
max_cron_threads = 2
db_maxconn = 64

What is the reason of the crash? Is it an odoo config error or a postgreSQL config error?


Avatar
Discard

We're suffering from a similair problem, only when running the scheduler. It seems like Odoo is keeping the connections "alive" (even though they might be idle) for well over 2 days. This might be the cause.

21south, Ludo - 21South

Do you have a better solution than set workers to 0?

Qué me envías?







   



2018-05-17 9:18 GMT+02:00 Nacho <nacho@baintex.com>:

21south, Ludo - 21South

Do you have a better solution than set workers to 0?

--
Nacho

Sent by Odoo S.A. using Odoo.


check postgres and system logs. you will surely find something. monitor how many idle users you have hanging in postgres so on. can't say much by looking at that log

Best Answer

Try to check your postgres config

(ex:/etc/postgresql/9.5/main/postgresql.conf in ubuntu) in max_connections 

maybe you have some other connections to your database, not just from odoo, and you need to increase it. 



Avatar
Discard

There is 100 max_connections in postgresql.conf file.

There are 8 instances of odoo connecting to the database.

I have set db_maxconn = 10 instead of 64 and now it works fine and it does not crash.

Best Answer

Here is the link which helps for worker calculations. so you can deploy odoo correctly. Have a look here maybe helps

https://www.odoo.com/documentation/10.0/setup/deploy.html#worker-number-calculation

Avatar
Discard
Author

I know this page but I don't know what is the problem with my configuration.

I put 7 workers and 2 max_cron_threads.

Why is the server crashing after a period of short time (less than a day)?

Can you please ask the same question here <technical@mail.odoo.com>

On Wed, May 16, 2018 at 7:57 PM, Baintex Technologies S.L. <mariajose@baintex.com> wrote:

I know this page but I don't know what is the problem with my configuration.

I put 7 workers and 2 max_cron_threads.

Why is the server crashing after a period of short time (less than a day)?

--
Baintex Technologies S.L.

Sent by Odoo S.A. using Odoo.




--
Hilar AK  Python / Odoo Developer

m: +917736617619
e: hilarak@gmail.com
Follow me:
twitteryoutubegithubstack-overflow


I have tried to send an email at that address and I only receive this automatic mail:

Invalid response code from remote server: 5

Final-Recipient: rfc822; technical@mail.odoo.com

Action: failed

Status: 4.5.0

Remote-MTA: dns; ob3.odoo.com. (137.74.205.210, the server for the domain mail.odoo.com.)

Diagnostic-Code: smtp; Invalid response code from remote server: 5 5 0 5 . 7 . 1 M a i l b o x u n a v a i l a b l e - M a i l b o x u n a v a i l a b l e - a l i a s t e c h n i c a l : r e s t r i c t e d t o c h a n n e l m e m b e r s

Last-Attempt-Date: Sat, 19 May 2018 10:18:43 -0700 (PDT)