cancel
Showing results for 
Search instead for 
Did you mean: 

ACT_GE_BYTEARRAY PacketTooBigException

mhanrahan
Confirmed Champ
Confirmed Champ

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)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:172)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.activiti.engine.impl.db.DbSqlSession.flushBulkInsert(DbSqlSession.java:856)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.db.DbSqlSession.flushPersistentObjects(DbSqlSession.java:820)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:797)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:618)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:212)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:138)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:66)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:79)[45Smiley Surprisedrg.activiti.engine:5.21.0.dgit-fix-6]
    at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:156)[45Smiley Surprisedrg.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)[91Smiley Surprisedrg.apache.commons.dbcp:1.4.0]
    at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)[91Smiley Surprisedrg.apache.commons.dbcp:1.4.0]
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:45)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:73)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)[224Smiley Surprisedrg.mybatis.mybatis:3.3.0]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)[224Smiley Surprisedrg.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

1 ACCEPTED ANSWER

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)

View answer in original post

3 REPLIES 3

gdharley
Elite Collaborator
Elite Collaborator

Likely this is more a function of an upgraded myBatis library or JDBC driver than the Activiti upgrade.

Either way, the error is being sent through the JDBC driver from the server so I doubt there is anything you can do within Activiti to solve the problem.

Regards,

Greg

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)

gdharley
Elite Collaborator
Elite Collaborator

Nice find.

I believe you can disable bulk inserts in the process engine configuration.

Cheers,

Greg

Sent from my iPhone