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

Flowable fails to be started in distributed scenario. #4029

Open
Wugengxian opened this issue Feb 19, 2025 · 0 comments
Open

Flowable fails to be started in distributed scenario. #4029

Wugengxian opened this issue Feb 19, 2025 · 0 comments

Comments

@Wugengxian
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant