JMeter性能测试下出现Activiti死锁
我遇到activiti并发问题。我们有一个带有嵌入式 activiti 工作流引擎的wicket spring 应用程序。它在没有并发用户的情况下工作正常,但在 jmeter 性能测试期间,activiti 在自己的表上创建死锁。例如:ACT_RU_JOB、ACT_RU_EXECUTION、ACT_RU_VARIABLE。我在 activiti 论坛上找到了关于此问题的主题( Activiti论坛)。他们建议使用队列来启动 activiti 进程。这个解决方案并没有解决问题,因为死锁仍然发生。我为您提供一些配置和堆栈跟踪。所有答案都对我有用。感谢您的帮助!
我的 activiti 配置:
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="databaseType" value="mssql" />
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManagerLugy" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="true" />
<property name="deploymentResources" value="classpath*:/diagrams/idm/*.bpmn20.xml" />
<property name="history" value="none"/>
<property name="jdbcMaxActiveConnections" value="1000"/>
<property name="jdbcMaxIdleConnections" value="10"/>
<property name="jdbcMaxWaitTime" value="50000"/>
</bean>
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
堆栈跟踪:
### Error querying database. Cause: org.hibernate.exception.LockAcquisitionException: Transaction (Process ID 67) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
### The error may involve org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId-Inline
### The error occurred while setting parameters
### Cause: org.hibernate.exception.LockAcquisitionException: Transaction (Process ID 67) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
at org.springframework.jms.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:471)
at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:355)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
at java.lang.Thread.run(Thread.java:662)
I have a problem with activiti concurrency. We have a wicket spring application with embedded activiti workflow engine. It works fine without concurrent users, but during jmeter performance test activiti creates deadlock on its own tables. For example: ACT_RU_JOB, ACT_RU_EXECUTION, ACT_RU_VARIABLE. I have found a topic on activiti forum about this problem ( Activiti Forum ). They suggest using queues to start activiti processes. This solution didn't solve the problem, because deadlocks still occuring. I provide some configuration and stacktrace for you. All answers can be useful for me. Thanks for the help!
my activiti configuration:
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="databaseType" value="mssql" />
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManagerLugy" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="true" />
<property name="deploymentResources" value="classpath*:/diagrams/idm/*.bpmn20.xml" />
<property name="history" value="none"/>
<property name="jdbcMaxActiveConnections" value="1000"/>
<property name="jdbcMaxIdleConnections" value="10"/>
<property name="jdbcMaxWaitTime" value="50000"/>
</bean>
<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
<property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>
stacktrace:
### Error querying database. Cause: org.hibernate.exception.LockAcquisitionException: Transaction (Process ID 67) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
### The error may involve org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.selectVariablesByExecutionId-Inline
### The error occurred while setting parameters
### Cause: org.hibernate.exception.LockAcquisitionException: Transaction (Process ID 67) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
at org.springframework.jms.listener.adapter.MessageListenerAdapter.invokeListenerMethod(MessageListenerAdapter.java:471)
at org.springframework.jms.listener.adapter.MessageListenerAdapter.onMessage(MessageListenerAdapter.java:355)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:535)
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:495)
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
at java.lang.Thread.run(Thread.java:662)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从我的活动图中删除了所有计时器,死锁也消失了。我不知道为什么,但它有效。
I removed all of the timers from my activiti diagram and deadlocks are disappeared. I don't know why, but it works.
我在执行jmeter测试时也遇到了死锁问题。
就我而言,问题是我的数据源池最多有 10 个连接
但有 100 个线程访问 api,创建一个需要创建异步任务的流程实例。
因此,如果 activiti 使用另一个连接(与创建流程实例的连接不同)来创建异步任务,那么在返回创建流程实例的连接之前,可能会出现死锁等待连接的情况(如果所有活动连接用于创建流程实例)
当我将池大小设置为大于jmeter线程数时,问题就消失了。
--
我的activiti版本是5.19.0
I also had the dead lock problem when performing jmeter test.
In my case, the problem is that my DataSource pool is max 10 connections
but had 100 threads accessing the api that create a process instance which need to create an async task.
so if activiti use another connection(different from the connection to create a process instance) to create the async task, before returning the connection that create the process instance, then there may be a chance of deadlocking waiting for the connection(if all active connections are used for creating process instance)
When i set the pool size bigger than the jmeter thread count, the problem has gone.
--
My activiti version is 5.19.0