Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于预设中心现有问题征集修复方案 #189

Open
KroMiose opened this issue Apr 9, 2024 · 0 comments
Open

关于预设中心现有问题征集修复方案 #189

KroMiose opened this issue Apr 9, 2024 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@KroMiose
Copy link
Owner

KroMiose commented Apr 9, 2024

当前ng版本启动服务时会尝试连接预设中心,但是由于预设中心存在bug,目前是无法使用状态,具体表现为:

容器启动时预设中心工作正常,但是在一段时间无数据库动作之后,再进行查询等操作会出现如下报错

  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2842, in _iter
    result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
            │                  │    │      │      │    │       └ <function Session.execute at 0x7febc818f910>
            │                  │    │      │      │    └ <sqlalchemy.orm.session.Session object at 0x7febc8780640>
            │                  │    │      │      └ <sqlalchemy.orm.query.Query object at 0x7febc85dd6f0>
            │                  │    │      └ ~_T
            │                  │    └ <class 'sqlalchemy.engine.result.Result'>
            │                  └ ~_T
            └ typing.Union
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2262, in execute
    return self._execute_internal(
           │    └ <function Session._execute_internal at 0x7febc818f880>
           └ <sqlalchemy.orm.session.Session object at 0x7febc8780640>
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 2144, in _execute_internal
    result: Result[Any] = compile_state_cls.orm_execute_statement(
                   │      │                 └ <classmethod(<function AbstractORMCompileState.orm_execute_statement at 0x7febc8524940>)>
                   │      └ <class 'sqlalchemy.orm.context.ORMSelectCompileState'>
                   └ typing.Any
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/orm/context.py", line 293, in orm_execute_statement
    result = conn.execute(
             │    └ <function Connection.execute at 0x7febc83739a0>
             └ <sqlalchemy.engine.base.Connection object at 0x7febc84215d0>
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1412, in execute
    return meth(
           └ <bound method ClauseElement._execute_on_connection of <sqlalchemy.sql.selectable.Select object at 0x7febc85dda80>>
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 515, in _execute_on_connection
    return connection._execute_clauseelement(
           │          └ <function Connection._execute_clauseelement at 0x7febc8373c70>
           └ <sqlalchemy.engine.base.Connection object at 0x7febc84215d0>
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1635, in _execute_clauseelement
    ret = self._execute_context(
          │    └ <function Connection._execute_context at 0x7febc8373e20>
          └ <sqlalchemy.engine.base.Connection object at 0x7febc84215d0>
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1808, in _execute_context
    conn = self._revalidate_connection()
           │    └ <function Connection._revalidate_connection at 0x7febc8372710>
           └ <sqlalchemy.engine.base.Connection object at 0x7febc84215d0>
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 665, in _revalidate_connection
    self._invalid_transaction()
    │    └ <function Connection._invalid_transaction at 0x7febc8372680>
    └ <sqlalchemy.engine.base.Connection object at 0x7febc84215d0>
  File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 655, in _invalid_transaction
    raise exc.PendingRollbackError(
          │   └ <class 'sqlalchemy.exc.PendingRollbackError'>
          └ <module 'sqlalchemy.exc' from '/usr/local/lib/python3.10/site-packages/sqlalchemy/exc.py'>

sqlalchemy.exc.PendingRollbackError: Can't reconnect until invalid transaction is rolled back.  Please rollback() fully before proceeding (Background on this error at: https://sqlalche.me/e/20/8s2b)

尝试进行查询定位后认为是数据库连接不活跃被断开,但是在添加 pool_pre_ping = True 或者修改数据库配置后仍然无效 相关code

运行环境

  • 操作系统: ubuntu-22.04
  • Mysql: 8.2.0
  • Mysql / PresetHub 均为 Docker 部署 (详见预设中心项目的 dockerfile 和 docker-compose 文件)

预设中心项目地址 现征集大佬高见,解决此问题后将继续长期开放预设中心 orz

@KroMiose KroMiose added the help wanted Extra attention is needed label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant