【问题标题】:Camunda DB connection closed but picked by camunda engineCamunda DB连接关闭但被camunda引擎选择
【发布时间】:2018-09-17 21:19:35
【问题描述】:

我们使用带有 RDS/MySql 的 camunda 作为数据库。它工作正常,但有时它说 DB 已关闭,因此引发 ProcessEngine 异常。 以下是我从我们的配置和日志中了解到的:

  1. 我们的池中随时都有 5 个活动连接(在数据源配置中指定)

  2. 有一个场景是关闭的。

  3. 我们看到如下错误:

收到的请求上下文路径:/engine-rest 收到的请求路径

信息:/用户路径信息:/用户异常处理程序:

org.camunda.bpm.engine.ProcessEngineException:流程引擎

持久性异常

org.camunda.bpm.engine.impl.interceptor.CommandInvocationContext.rethrow(CommandInvocationContext.java:148)

    at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:173)

    at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:113)

    at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)

    at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)

...... 引起:org.apache.ibatis.exceptions.PersistenceException:

查询数据库时出错。原因:

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:

连接关闭后不允许任何操作。错误可能存在于

org/camunda/bpm/engine/impl/mapping/entity/User.xml 错误可能 涉及

org.camunda.bpm.engine.impl.persistence.entity.UserEntity.selectUserByQueryCriteria

执行查询 SQL 时出错:select distinct RES.*

来自 ACT_ID_USER RES

按 RES.ID_asc LIMIT 排序?抵消 ?原因:

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:

连接关闭后不允许任何操作。

我们的 tomcat 道具指定:minIdle = 5;

我的最佳猜测:它在服务器上关闭,但由于上述属性,我们正在本地维护。

每个 tomcat 文档 (https://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html):

testOnBorrow = true; 验证查询 = "选择 1";

这两个道具应该在验证连接时修复它。

我想弄清楚的问题:

  1. 如何重现此问题?除了保持连接空闲几个小时之外,发生这种情况的场景。

  2. AWS RDS 服务器是否关闭连接?如果是这样,我们可以控制它吗?

【问题讨论】:

  • 我可以想象将连接超时设置为较低的值以更快地检查这个
  • 做到了!我有两个这样的实例,我减少了超时并进行了测试,它确实有效。只是为了确定修复:我有一个带有修复的实例,而另一个没有。一个有修复的工作,而另一个抛出了同样的错误。

标签: java mysql spring tomcat camunda


【解决方案1】:

正如@Zelldon 所说,可以减少连接超时,然后我们可以尝试一下。它按预期工作。

为了确定,我运行了两个 camunda 实例,一个带有此修复程序,另一个没有。可以看到修复工作。

关于 RDS,它确实关闭了连接,但我找不到任何文档。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-02
    • 1970-01-01
    相关资源
    最近更新 更多