Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-4078

MyBatis/OGNL bugs lead to MyBatis exceptions under heavy load

    XMLWordPrintable

Details

    • Bug Report
    • Resolution: Fixed
    • L3 - Default
    • 7.4.0, 7.3.2, 7.4.0-alpha1
    • 7.3.0
    • engine
    • None

    Description

      Problem description:

      • executing many concurrent requests leads to exceptions thrown by mybatis.

      Context Information:

      We should only try to fix this for the current MyBatis version. Upgrading to a newer version of Mybatis can be extracted as an individual issue but we will not work on that now.

      ===

      Notes:

      See Forum: https://groups.google.com/forum/#!msg/camunda-bpm-users/2UTm6fbKeMw/shAYRRZIXrgJ

      When putting load on the engine you might see the exception mentioned in the forum post. I could reproduce this using the attached JMeter Testplan).

      Upgrading to Mybatis 3.3.0 rsolves that problem - at least I could no longer reproduce the error (I removed all orderBy manually to be able to run the tests with MyBatis 3.3.0 - see next line).

      But with MyBatis 3.3.0 all "select..:By" queries are broken due to the orderBy-logic, e.g.:

      SEVERE: Error while closing command context
      org.apache.ibatis.exceptions.PersistenceException:
      ### Error querying database.  Cause: org.h2.jdbc.JdbcSQLException: Syntax Fehler in SQL Befehl "SELECT RES.*
      
      
          FROM ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           ORDER BY  ORDER[*] BY RES.ID_ ASC
          LIMIT ? OFFSET ? "; erwartet "=, NOT, EXISTS, SELECT, FROM"
      Syntax error in SQL statement "SELECT RES.*
      
      
          FROM ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           ORDER BY  ORDER[*] BY RES.ID_ ASC
          LIMIT ? OFFSET ? "; expected "=, NOT, EXISTS, SELECT, FROM"; SQL statement:
      select RES.*
      
      
          from ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           order by  order by RES.ID_ asc
          LIMIT ? OFFSET ? [42001-168]
      ### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/ProcessDefinition.xml
      ### The error may involve org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity.selectProcessDefinitionsByQueryCriteria
      ### The error occurred while executing a query
      ### SQL: select RES.*                   from ACT_RE_PROCDEF RES                  WHERE  RES.DEPLOYMENT_ID_ = ?           order by  order by RES.ID_ asc       LIMIT ? OFFSET ?
      ### Cause: org.h2.jdbc.JdbcSQLException: Syntax Fehler in SQL Befehl "SELECT RES.*
      
      
          FROM ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           ORDER BY  ORDER[*] BY RES.ID_ ASC
          LIMIT ? OFFSET ? "; erwartet "=, NOT, EXISTS, SELECT, FROM"
      Syntax error in SQL statement "SELECT RES.*
      
      
          FROM ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           ORDER BY  ORDER[*] BY RES.ID_ ASC
          LIMIT ? OFFSET ? "; expected "=, NOT, EXISTS, SELECT, FROM"; SQL statement:
      select RES.*
      
      
          from ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           order by  order by RES.ID_ asc
          LIMIT ? OFFSET ? [42001-168]
              at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
              at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122)
              at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113)
              at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.selectList(DbSqlSession.java:86)
              at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectListWithRawParameter(DbEntityManager.java:164)
              at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectList(DbEntityManager.java:156)
              at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.selectList(DbEntityManager.java:148)
              at org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionManager.findProcessDefinitionsByQueryCriteria(ProcessDefinitionManager.java:57)
              at org.camunda.bpm.engine.impl.ProcessDefinitionQueryImpl.executeList(ProcessDefinitionQueryImpl.java:249)
              at org.camunda.bpm.engine.impl.AbstractQuery.evaluateExpressionsAndExecuteList(AbstractQuery.java:179)
              at org.camunda.bpm.engine.impl.AbstractQuery.list(AbstractQuery.java:136)
              at org.camunda.bpm.engine.impl.cmd.DeployCmd.getDeployedProcesses(DeployCmd.java:273)
              at org.camunda.bpm.engine.impl.cmd.DeployCmd.resumePreviousByProcessDefinitionKey(DeployCmd.java:244)
              at org.camunda.bpm.engine.impl.cmd.DeployCmd.registerProcessApplication(DeployCmd.java:216)
              at org.camunda.bpm.engine.impl.cmd.DeployCmd$1.call(DeployCmd.java:105)
              at org.camunda.bpm.engine.impl.cmd.DeployCmd$1.call(DeployCmd.java:82)
              at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:485)
              at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:82)
              at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:65)
              at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
              at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:97)
              at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:32)
              at org.camunda.bpm.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:82)
              at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:125)
              at org.camunda.bpm.engine.impl.repository.ProcessApplicationDeploymentBuilderImpl.deploy(ProcessApplicationDeploymentBuilderImpl.java:57)
              at org.camunda.bpm.container.impl.deployment.DeployProcessArchiveStep.performOperationStep(DeployProcessArchiveStep.java:129)
              at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:117)
              at org.camunda.bpm.container.impl.jmx.MBeanServiceContainer.executeDeploymentOperation(MBeanServiceContainer.java:148)
              at org.camunda.bpm.container.impl.spi.DeploymentOperation$DeploymentOperationBuilder.execute(DeploymentOperation.java:209)
              at org.camunda.bpm.container.impl.RuntimeContainerDelegateImpl.deployProcessApplication(RuntimeContainerDelegateImpl.java:87)
              at org.camunda.bpm.application.AbstractProcessApplication.deploy(AbstractProcessApplication.java:51)
              at org.camunda.bpm.application.impl.ServletProcessApplication.contextInitialized(ServletProcessApplication.java:131)
              at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5014)
              at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
              at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
              at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
              at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
              at java.util.concurrent.FutureTask.run(FutureTask.java:166)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
              at java.lang.Thread.run(Thread.java:724)
      Caused by: org.h2.jdbc.JdbcSQLException: Syntax Fehler in SQL Befehl "SELECT RES.*
      
      
          FROM ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           ORDER BY  ORDER[*] BY RES.ID_ ASC
          LIMIT ? OFFSET ? "; erwartet "=, NOT, EXISTS, SELECT, FROM"
      Syntax error in SQL statement "SELECT RES.*
      
      
          FROM ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           ORDER BY  ORDER[*] BY RES.ID_ ASC
          LIMIT ? OFFSET ? "; expected "=, NOT, EXISTS, SELECT, FROM"; SQL statement:
      select RES.*
      
      
          from ACT_RE_PROCDEF RES
      
      
           WHERE  RES.DEPLOYMENT_ID_ = ?
      
           order by  order by RES.ID_ asc
          LIMIT ? OFFSET ? [42001-168]
              at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
              at org.h2.message.DbException.get(DbException.java:169)
              at org.h2.message.DbException.getSyntaxError(DbException.java:194)
              at org.h2.command.Parser.getSyntaxError(Parser.java:491)
              at org.h2.command.Parser.readTerm(Parser.java:2447)
              at org.h2.command.Parser.readFactor(Parser.java:2046)
              at org.h2.command.Parser.readSum(Parser.java:2033)
              at org.h2.command.Parser.readConcat(Parser.java:2006)
              at org.h2.command.Parser.readCondition(Parser.java:1871)
              at org.h2.command.Parser.readAnd(Parser.java:1852)
              at org.h2.command.Parser.readExpression(Parser.java:1844)
              at org.h2.command.Parser.parseEndOfQuery(Parser.java:1578)
              at org.h2.command.Parser.parseSelectUnionExtension(Parser.java:1558)
              at org.h2.command.Parser.parseSelectUnion(Parser.java:1528)
              at org.h2.command.Parser.parseSelect(Parser.java:1515)
              at org.h2.command.Parser.parsePrepared(Parser.java:405)
              at org.h2.command.Parser.parse(Parser.java:279)
              at org.h2.command.Parser.parse(Parser.java:255)
              at org.h2.command.Parser.prepareCommand(Parser.java:217)
              at org.h2.engine.Session.prepareLocal(Session.java:415)
              at org.h2.engine.Session.prepareCommand(Session.java:364)
              at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1109)
              at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:74)
              at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:264)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
              at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
              at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80)
              at com.sun.proxy.$Proxy6.prepareStatement(Unknown Source)
              at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:79)
              at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
              at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:58)
              at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:76)
              at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:61)
              at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:303)
              at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:154)
              at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:102)
              at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
              at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:120)
              ... 44 more
      

      This has to adressed before moving to MyBatis 3.3.0

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Issue Links

            Activity

              People

                thorben.lindhauer Thorben Lindhauer
                ruecker Bernd Ruecker
                Votes:
                3 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  Salesforce