错误:致命:“p_my_oerp_master_11234451”角色的连接太多

2w2cym1i  于 2022-10-02  发布在  Python
关注(0)|答案(2)|浏览(192)

自从今天(9月30日)在Odoo.sh上使用Odoo V13后,在以“admin”或其他Odoo用户身份登录我的Odoo帐户后,我每分钟都会收到以下错误,并断开我的会话:

psycopg2.OperationalError: FATAL:  too many connections for role "p_my_oerp_master_1123445"

回溯:

2022-09-30 17:01:32,442 30903 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at /usr/local/bin/wkhtmltopdf
2022-09-30 17:01:32,657 30903 INFO ? odoo.service.server: HTTP service (werkzeug) running through socket activation
2022-09-30 17:01:32,666 30903 INFO ? odoo.sql_db: Connection to the database failed
2022-09-30 17:01:32,667 30903 CRITICAL ? odoo.service.server: Failed to initialize database `my-oerp-master-1123445`. 
Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/service/server.py", line 1194, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 75, in new
    registry.init(db_name)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 144, in init
    with closing(self.cursor()) as cr:
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 563, in cursor
    return self._db.cursor()
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 669, in cursor
    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 196, in __init__
    self._cnx = pool.borrow(dsn)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 552, in _locked
    return fun(self, *args,**kwargs)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 620, in borrow
  **connection_info)
  File "/usr/local/lib/python3.6/dist-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory,**kwasync)
psycopg2.OperationalError: FATAL:  too many connections for role "p_my_oerp_master_1123445"
2022-09-30 17:01:32,727 30903 INFO ? odoo.http: HTTP Configuring static files
2022-09-30 17:01:32,736 30903 INFO my-oerp-master-1123445 odoo.sql_db: Connection to the database failed
2022-09-30 17:01:32,737 30903 INFO my-oerp-master-1123445 odoo.http: Generating nondb routing
2022-09-30 17:01:32,755 30903 INFO None odoo.sql_db: Connection to the database failed
2022-09-30 17:01:32,755 30903 WARNING my-oerp-master-1123445 odoo.service.model: method ir.cron.acquire_job failed during rpc call: FATAL:  too many connections for role "p_my_oerp_master_1123445"
2022-09-30 17:01:32,755 30903 ERROR my-oerp-master-1123445 odoo.http: FATAL:  too many connections for role "p_my_oerp_master_1123445"

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 61, in __new__
    return cls.registries[db_name]
  File "/home/odoo/src/odoo/odoo/tools/func.py", line 69, in wrapper
    return func(self, *args,**kwargs)
  File "/home/odoo/src/odoo/odoo/tools/lru.py", line 44, in __getitem__
    a = self.d[obj].me
KeyError: 'my-oerp-master-1123445'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 1479, in dispatch
    odoo.registry(db).check_signaling()
  File "/home/odoo/src/odoo/odoo/__init__.py", line 104, in registry
    return modules.registry.Registry(database_name)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 63, in __new__
    return cls.new(db_name)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 75, in new
    registry.init(db_name)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 144, in init
    with closing(self.cursor()) as cr:
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 563, in cursor
    return self._db.cursor()
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 669, in cursor
    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 196, in __init__
    self._cnx = pool.borrow(dsn)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 552, in _locked
    return fun(self, *args,**kwargs)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 620, in borrow
  **connection_info)
  File "/usr/local/lib/python3.6/dist-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory,**kwasync)
psycopg2.OperationalError: FATAL:  too many connections for role "p_my_oerp_master_1123445"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 61, in __new__
    return cls.registries[db_name]
  File "/home/odoo/src/odoo/odoo/tools/func.py", line 69, in wrapper
    return func(self, *args,**kwargs)
  File "/home/odoo/src/odoo/odoo/tools/lru.py", line 44, in __getitem__
    a = self.d[obj].me
KeyError: 'my-oerp-master-1123445'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 139, in dispatch_rpc
    result = dispatch(method, params)
  File "/usr/local/bin/odoo-rpc", line 26, in dispatch
    return odoo_dispatch(method, [db, odoo.SUPERUSER_ID, None] + list(params))
  File "/home/odoo/src/odoo/odoo/service/model.py", line 38, in dispatch
    registry = odoo.registry(db).check_signaling()
  File "/home/odoo/src/odoo/odoo/__init__.py", line 104, in registry
    return modules.registry.Registry(database_name)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 63, in __new__
    return cls.new(db_name)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 75, in new
    registry.init(db_name)
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 144, in init
    with closing(self.cursor()) as cr:
  File "/home/odoo/src/odoo/odoo/modules/registry.py", line 563, in cursor
    return self._db.cursor()
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 669, in cursor
    return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 196, in __init__
    self._cnx = pool.borrow(dsn)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 552, in _locked
    return fun(self, *args,**kwargs)
  File "/home/odoo/src/odoo/odoo/sql_db.py", line 620, in borrow
  **connection_info)
  File "/usr/local/lib/python3.6/dist-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory,**kwasync)
psycopg2.OperationalError: FATAL:  too many connections for role "p_my_oerp_master_1123445"
pdsfdshx

pdsfdshx1#

根据您提交的错误,它似乎是一个不断在后台运行的SQL命令,随着更多的用户登录,数据库将崩溃。这可能是由于第三方模块或定制代码(通过Studio创建)造成的。

在PaaS中,您可以使用webshell中的pg_activity检查正在运行的查询,并使用以下查询终止阻塞查询或检查psql中指定用户的连接:

SELECT *
FROM   pg_stat_activity
WHERE  usename = 'p_my_oerp_master_1123445';

然后通过使用PG_CANCEL_BACKEND(Id)终止阻塞查询来取消用户连接

请确保不要出错,否则可能会终止一些重要的查询。

68bkxrlz

68bkxrlz2#

我的问题似乎是由绞刑过程引起的。在Odoo.sh>监视选项卡中...“性能分析”工具使您能够启动Odoo工作器的分析会话。对于每个会话,都会为您生成一个交互式火焰图,以直观地显示您的Odoo员工正在花费哪些时间。

得到的火焰图如下:有人知道如何处理这样的结果吗?

相关问题