首页 > 解决方案 > psycopg2.DatabaseError:状态为 PGRES_TUPLES_OK 的错误,并且没有来自 Flask Celery 应用程序中的 libpq 错误的消息

问题描述

在随机发生的情况下,我注意到使用 SQLAlchemy 的 Flask Celery 应用程序中的此类错误。

当我检查数据库连接时,它很好。该应用程序似乎以某种方式失去了与 PostgreSQL 数据库服务器的连接。

    [2021-02-08 00:01:00,124: ERROR/ForkPoolWorker-1] Task gbms.celery_service.create_recurring_tasks[04c258ab-9162-44ed-86ff-f90c4a214fd2] raised unexpected: DatabaseError('(psycopg2.DatabaseError) error with status PGRES_TUPLES_OK and no message from the libpq')
Traceback (most recent call last):
  File "/gbmsenv/lib64/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
    self.dialect.do_execute(
  File "/gbmsenv/lib64/python3.8/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
    cursor.execute(statement, parameters)
psycopg2.DatabaseError: error with status PGRES_TUPLES_OK and no message from the libpq

The above exception was the direct cause of the following exception:

我应该采取哪些步骤来确定原因并解决问题?

标签: pythonflaskceleryflask-sqlalchemy

解决方案


推荐阅读