We recently upgraded the version of Activiti that we were using from 5.16.3 to 5.21, and we have started to receive this error when we are deploying process bundles via OSGi:
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (5157650 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
### The error may involve org.activiti.engine.impl.persistence.entity.ResourceEntity.bulkInsertResource-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_, GENERATED_) VALUES (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?) , (?, 1, ?, ?, ?, ?)
### Cause: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (5157650 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)[224rg.mybatis.mybatis:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:172)[224rg.mybatis.mybatis:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)[224rg.mybatis.mybatis:3.3.0]
at org.activiti.engine.impl.db.DbSqlSession.flushBulkInsert(DbSqlSession.java:856)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.db.DbSqlSession.flushPersistentObjects(DbSqlSession.java:820)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:797)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:618)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:79)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:156)[45rg.activiti.engine:5.21.0.dgit-fix-6]
at org.activiti.osgi.Extender.checkBundle(Extender.java:224)[9:activiti-osgi:5.21.0.dgit-fix-6]
at org.activiti.osgi.Extender.checkInitialBundle(Extender.java:147)[9:activiti-osgi:5.21.0.dgit-fix-6]
at org.activiti.osgi.Extender.addingBundle(Extender.java:105)[9:activiti-osgi:5.21.0.dgit-fix-6]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:469)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:415)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.BundleTracker.open(BundleTracker.java:156)[org.osgi.core-6.0.0.jar:]
at org.activiti.osgi.Extender$1.run(Extender.java:86)[9:activiti-osgi:5.21.0.dgit-fix-6]
Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (5157650 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3915)[22:com.mysql.jdbc:5.1.29]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2598)[22:com.mysql.jdbc:5.1.29]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2778)[22:com.mysql.jdbc:5.1.29]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2834)[22:com.mysql.jdbc:5.1.29]
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2156)[22:com.mysql.jdbc:5.1.29]
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379)[22:com.mysql.jdbc:5.1.29]
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)[91rg.apache.commons.dbcp:1.4.0]
at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)[91rg.apache.commons.dbcp:1.4.0]
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:45)[224rg.mybatis.mybatis:3.3.0]
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:73)[224rg.mybatis.mybatis:3.3.0]
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)[224rg.mybatis.mybatis:3.3.0]
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)[224rg.mybatis.mybatis:3.3.0]
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)[224rg.mybatis.mybatis:3.3.0]
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)[224rg.mybatis.mybatis:3.3.0]
... 22 more
I would like to avoid changing the max_allowed_packet property of MySQL as the Database is administered by someone else. The contents of the bundle we are trying to deploy add up to ~3mb.
This exact same bundle works with Activiti 5.16.3
Solved! Go to Solution.
I did some further digging and traced through the activiti 5.21 codebase, and found that now the insert is being done in bulk, whereas in 5.16 the insert was done individually.
https://activiti.atlassian.net/browse/ACT-4014 looks to be the issue that it was changed with (in 5.18)
I did some further digging and traced through the activiti 5.21 codebase, and found that now the insert is being done in bulk, whereas in 5.16 the insert was done individually.
https://activiti.atlassian.net/browse/ACT-4014 looks to be the issue that it was changed with (in 5.18)
Nice find.
I believe you can disable bulk inserts in the process engine configuration.
Cheers,
Greg
Sent from my iPhone
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.