AnsweredAssumed Answered

Timeout trying to lock table 'ACT_HI_ACTINST' [50200-132]

Question asked by ronnie_and_sandy on Dec 1, 2011
Latest reply on Dec 5, 2011 by ronnie_and_sandy
Apologies again for having to include logs and scripts in-line. All attachment extensions I've tried are not allowed.

We are looking at how Activiti handles process failure.

The contrived script, below, throws an exception on the 2nd task.

Immediate attempts to go to the Manage link in activiti-explorer fail, with the "lock" message showing up in the tomcat console.

This was originally done w/ an instance of Activiti 5.8 that we had on our server for awhile, but it also happens with a brand new install, so it should be easily reproduced. The error sometimes takes on other forms, such as fails to insert into ACT_HI_ACTINST for "good" processes. I've also gotten into the Manage link, only to get the "lock" message when attempting to scroll to the bottom of the ACT_HI_ACTINST contents. I've even seen the server "recover" from the lock error, at least temporarily. As I composed this, it recovered, but has slipped back into a bad lock state when attempting to view ACT_HI_ACTINST

——

bpmn script:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
    <process id="TableLockError" name="TableLockError">
        <documentation>Place documentation for the 'TableLockError' process here.</documentation>
        <startEvent id="startevent1" name="Start"></startEvent>
        <scriptTask id="hello1" name="hello1" scriptFormat="groovy">
            <script>
                System.out.println("hello1");
            </script>
        </scriptTask>
        <scriptTask id="conditionalFail" name="conditionalFail" scriptFormat="groovy">
            <script>
                throw new Throwable("new Throwable");
            </script>
        </scriptTask>
        <scriptTask id="hello2" name="hello2" scriptFormat="groovy">
            <script>
                System.out.println("hello2");
            </script>
        </scriptTask>
        <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="hello1"></sequenceFlow>
        <endEvent id="endevent1" name="End"></endEvent>
        <sequenceFlow id="flow2" name="" sourceRef="hello1" targetRef="conditionalFail"></sequenceFlow>
        <sequenceFlow id="flow3" name="" sourceRef="conditionalFail" targetRef="hello2"></sequenceFlow>
        <sequenceFlow id="flow4" name="" sourceRef="hello2" targetRef="endevent1"></sequenceFlow>
    </process>
</definitions>

——

tomcat log:

Dec 1, 2011 4:36:57 PM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: couldn't get table counts
        at org.activiti.engine.impl.persistence.entity.TableDataManager.getTableCount(TableDataManager.java:50)
        at org.activiti.engine.impl.cmd.GetTableCountCmd.execute(GetTableCountCmd.java:30)
        at org.activiti.engine.impl.cmd.GetTableCountCmd.execute(GetTableCountCmd.java:25)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
        at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
        at org.activiti.engine.impl.ManagementServiceImpl.getTableCount(ManagementServiceImpl.java:42)
        at org.activiti.explorer.ui.management.db.DatabasePage.populateTableList(DatabasePage.java:93)
        at org.activiti.explorer.ui.management.db.DatabasePage.initUi(DatabasePage.java:57)
        at org.activiti.explorer.ui.AbstractPage.attach(AbstractPage.java:43)
        at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:570)
        at com.vaadin.ui.AbstractComponentContainer.addComponent(AbstractComponentContainer.java:211)
        at com.vaadin.ui.CssLayout.addComponent(CssLayout.java:93)
        at org.activiti.explorer.ui.mainlayout.MainLayout.setMainContent(MainLayout.java:58)
        at org.activiti.explorer.ui.MainWindow.switchView(MainWindow.java:79)
        at org.activiti.explorer.DefaultViewManager.switchView(DefaultViewManager.java:272)
        at org.activiti.explorer.DefaultViewManager.showDatabasePage(DefaultViewManager.java:214)
        at org.activiti.explorer.ui.mainlayout.MainMenuBar$ShowManagementClickListener.buttonClick(MainMenuBar.java:203)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)
        at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
        at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1193)
        at com.vaadin.ui.Button.fireClick(Button.java:539)
        at com.vaadin.ui.Button.changeVariables(Button.java:206)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1299)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1219)
        at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:735)
        at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
        at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: Timeout trying to lock table "ACT_HI_ACTINST" [50200-132]
        at org.h2.message.DbException.getJdbcSQLException(DbException.java:316)
        at org.h2.message.DbException.get(DbException.java:167)
        at org.h2.message.DbException.get(DbException.java:144)
        at org.h2.table.RegularTable.doLock(RegularTable.java:444)
        at org.h2.table.RegularTable.lock(RegularTable.java:382)
        at org.h2.table.TableFilter.lock(TableFilter.java:117)
        at org.h2.command.dml.Select.queryWithoutCache(Select.java:542)
        at org.h2.command.dml.Query.query(Query.java:233)
        at org.h2.command.CommandContainer.query(CommandContainer.java:80)
        at org.h2.command.Command.executeQuery(Command.java:132)
        at org.h2.server.TcpServerThread.process(TcpServerThread.java:276)
        at org.h2.server.TcpServerThread.run(TcpServerThread.java:135)
        at java.lang.Thread.run(Thread.java:662)

### The error may involve org.activiti.engine.impl.TablePageMap.selectTableCount-Inline
### The error occurred while setting parameters

Outcomes