flowable / flowable/flowable-engine
Flowable fails to be started in distributed scenario.
- Vorherrschende Sprache
- Java
- Sterne
- 9.5k
- Forks
- 2.9k
- Ø Merge
- 7 Std. 8 Min.
- Gemergte PRs (30 T.)
- 2
Beschreibung
**Describe the bug**
An error is occasionally reported when the flowable engine is started in a distributed system.
```
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.huawei.gauss.exception.GaussException: [errorCode=GS-00729, SQLState='28000', reason='errLine = 0, errColumn = 0, errMsg=Unique constraint violated, index _PK_SYS_1_25, duplicate key cfg.task-related-entities-count,ioClient:@796811a5', sessionId=60, serverIP=127.0.0.1:26566, clientIP=10.118.241.216.]
### The error may exist in org/flowable/common/db/mapping/entity/Property.xml
### The error may involve org.flowable.common.engine.impl.persistence.entity.PropertyEntityImpl.insertProperty-Inline
### The error occurred while setting parameters
### SQL: insert into ACT_GE_PROPERTY ( NAME_, VALUE_, REV_ ) values ( ?, ?, 1 )
### Cause: com.huawei.gauss.exception.GaussException: [errorCode=GS-00729, SQLState='28000', reason='errLine = 0, errColumn = 0, errMsg=Unique constraint violated, index _PK_SYS_1_25, duplicate key cfg.task-related-entities-count,ioClient:@796811a5', sessionId=60, serverIP=127.0.0.1:26566, clientIP=127.0.0.1.]
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.5.13.jar:3.5.13]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199) ~[mybatis-3.5.13.jar:3.5.13]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184) ~[mybatis-3.5.13.jar:3.5.13]
at org.flowable.common.engine.impl.db.DbSqlSession.flushRegularInsert(DbSqlSession.java:519) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.db.DbSqlSession.flushInsertEntities(DbSqlSession.java:500) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:483) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:368) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.interceptor.CommandContext.close(CommandContext.java:70) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:114) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51) ~[flowable-engine-common-6.8.1.jar:6.8.1]
at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.postProcessEngineInitialisation(ProcessEngineConfigurationImpl.java:2724) ~[flowable-engine-6.8.1.jar:6.8.1]
at org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:934) ~[flowable-engine-6.8.1.jar:6.8.1]
at com.huawei.nceanalyzer.function.recipe.management.facade.FlowableEngineFacadeImpl.initInstance(FlowableEngineFacadeImpl.java:114) ~[function-recipe-management-11.16.1140-vm.jar:?]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_432]
Caused by: com.huawei.gauss.exception.GaussException: [errorCode=GS-00729, SQLState='28000', reason='errLine = 0, errColumn = 0, errMsg=Unique constraint violated, index _PK_SYS_1_25, duplicate key cfg.task-related-entities-count,ioClient:@796811a5', sessionId=60, serverIP=127.0.0.1:26566, clientIP=127.0.0.1.]
at com.huawei.gauss.exception.ExceptionUtil.processGaussException(SourceFile:104) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.handler.inner.MessageProcessHelper.doExecute(SourceFile:82) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.handler.preparestmt.inner.PrepareStmtMsgProcessCHandler.doExecute(SourceFile:160) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.handler.statement.DefaultStatmentCHandler.doExecuteOnTimer(SourceFile:172) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.handler.preparestmt.inner.PrepareStmtMsgProcessCHandler.preCommonPrepareExecute(SourceFile:118) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.handler.preparestmt.inner.PrepareStmtMsgProcessCHandler.preExecute(SourceFile:64) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.channel.context.statement.prepare.PrepareStmtExecuteContext.preProcess(SourceFile:51) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.jdbc.inner.ChannelExecutor.execute(SourceFile:40) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.jdbc.inner.GaussPrepareStatementHelper.execute(SourceFile:64) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at com.huawei.gauss.jdbc.inner.GaussPrepareStmtImpl.execute(SourceFile:131) ~[com.huawei.gauss.jdbc.ZenithDriver-1.9.1.jar:?]
at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:95) ~[commons-dbcp2-2.12.0.jar:2.12.0]
at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:95) ~[commons-dbcp2-2.12.0.jar:2.12.0]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:48) ~[mybatis-3.5.13.jar:3.5.13]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:75) ~[mybatis-3.5.13.jar:3.5.13]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) ~[mybatis-3.5.13.jar:3.5.13]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.5.13.jar:3.5.13]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.5.13.jar:3.5.13]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ~[mybatis-3.5.13.jar:3.5.13]
... 15 more
```
**Expected behavior**
In the distributed scenario, the Flowable does not occasionally report errors and can be started successfully.
**Code**
```java
engineConfiguration.setCustomFlowableFunctionDelegates(functionDelegates);
engineConfiguration.setActivityBehaviorFactory(new CustomActivityBehaviorFactory());
engineConfiguration.setHistoryLevel(HistoryLevel.NONE);
processEngine = engineConfiguration.buildProcessEngine();
```
I see the question is in `org.flowable.engine.impl.cmd.ValidateExecutionRelatedEntityCountCfgCmd#execute`, The distributed scenario is not considered in the code leading to competitive scenarios.
**Additional context**
flowable: 6.8.1
database: h2
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginnen Sie mit org.flowable.engine.impl.cmd.ValidateExecutionRelatedEntityCountCfgCmd#execute und verfolgen Sie, wie dieser während buildProcessEngine im gezeigten verteilten Startvorgang erreicht wird. Reproduzieren Sie den gleichzeitigen Start mit dem gemeldeten Datenbankszenario und verifizieren Sie, dass Fehler aufgrund doppelter Eigenschaften Flowable nicht mehr daran hindern, erfolgreich zu starten.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- backend, databases, distributed-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100