Lock wait timeout exceeded and java.sql.SQLException

Getting SQL exception some time while application is have few 10 to 20 parallel request

{“@timestamp”:“2022-10-12T01:00:59.930+00:00”,“message”:“Before message OrderDecompositionCompletedEvent publish sleep for 4sec”,“logger_name”:“c.t.b.o.d.i.d.d.PublishDecompositionCompletedDelegate”,“level”:“INFO”,“tenantId”:“default-tenant”,“correlationId”:“crr-unknown”,“userId”:“anonymousUser”,“sourceChannel”:“ch-unknown”,“transactionId”:“tx-unknown”,“applicationName”:“Order Decomposition Invocation Application”}
{“@timestamp”:“2022-10-12T01:01:32.597+00:00”,“message”:“Error: 1205-HY000: Lock wait timeout exceeded; try restarting transaction”,“logger_name”:“o.m.j.m.server.ErrorPacket”,“level”:“WARN”,“tenantId”:“default-tenant”,“correlationId”:“crr-unknown”,“userId”:“anonymousUser”,“sourceChannel”:“ch-unknown”,“transactionId”:“tx-unknown”,“applicationName”:“Order Decomposition Invocation Application”}
{“@timestamp”:“2022-10-12T01:01:32.599+00:00”,“message”:“Error while closing command context”,“logger_name”:“o.f.c.e.i.i.CommandContext”,“level”:“ERROR”,“stack_trace”:“java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction\n\tat o.m.j.export.ExceptionFactory.createException(ExceptionFactory.java:297)\n\tat o.m.j.export.ExceptionFactory.create(ExceptionFactory.java:368)\n\tat o.m.jdbc.message.ClientMessage.readPacket(ClientMessage.java:137)\n\tat o.m.j.c.impl.StandardClient.readPacket(StandardClient.java:819)\n\tat o.m.j.c.impl.StandardClient.readResults(StandardClient.java:758)\n\tat o.m.j.c.impl.StandardClient.readResponse(StandardClient.java:677)\n\tat o.m.j.c.impl.StandardClient.execute(StandardClient.java:620)\n\tat o.m.j.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:93)\n\tat o.m.j.ClientPreparedStatement.execute(ClientPreparedStatement.java:256)\n\tat c.z.h.p.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)\n\tat c.z.h.p.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)\n\tat o.a.i.e.s.PreparedStatementHandler.update(PreparedStatementHandler.java:47)\n\tat o.a.i.e.s.RoutingStatementHandler.update(RoutingStatementHandler.java:74)\n\tat o.a.i.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)\n\tat o.a.i.executor.BaseExecutor.update(BaseExecutor.java:117)\n\t… 2 frames truncated\n\t… 49 common frames omitted\nWrapped by: o.a.i.e.PersistenceException: \n### Error updating database. Cause: java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction\n### The error may exist in org/flowable/common/db/mapping/entity/ByteArray.xml\n### The error may involve org.flowable.common.engine.impl.persistence.entity.ByteArrayEntityImpl.bulkInsertByteArray-Inline\n### The error occurred while setting parameters\n### SQL: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_) values (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, …”,“tenantId”:“default-tenant”,“correlationId”:“crr-unknown”,“userId”:“anonymousUser”,“sourceChannel”:“ch-unknown”,“transactionId”:“tx-unknown”,“applicationName”:“Order Decomposition Invocation Application”}
{“@timestamp”:“2022-10-12T01:01:32.600+00:00”,“message”:" In Future Dated WorkFlow Instantiation Process For Service Order Id (SO1665512512339374)- error : \n### Error updating database. Cause: java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction\n### The error may exist in org/flowable/common/db/mapping/entity/ByteArray.xml\n### The error may involve org.flowable.common.engine.impl.persistence.entity.ByteArrayEntityImpl.bulkInsertByteArray-Inline\n### The error occurred while setting parameters\n### SQL: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_) values (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?)\n### Cause: java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction “,“logger_name”:“c.t.b.o.d.i.s.WorkFlowIdentification”,“level”:“ERROR”,“tenantId”:“default-tenant”,“correlationId”:“crr-unknown”,“userId”:“anonymousUser”,“sourceChannel”:“ch-unknown”,“transactionId”:“tx-unknown”,“applicationName”:“Order Decomposition Invocation Application”}
{”@timestamp":“2022-10-12T01:01:32.600+00:00”,“message”:“\n### Error updating database. Cause: java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction\n### The error may exist in org/flowable/common/db/mapping/entity/ByteArray.xml\n### The error may involve org.flowable.common.engine.impl.persistence.entity.ByteArrayEntityImpl.bulkInsertByteArray-Inline\n### The error occurred while setting parameters\n### SQL: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_) values (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?)\n### Cause: java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction”,“logger_name”:“c.t.b.o.d.i.s.WorkFlowIdentification”,“level”:“ERROR”,“stack_trace”:“java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction\n\tat o.m.j.export.ExceptionFactory.createException(ExceptionFactory.java:297)\n\tat o.m.j.export.ExceptionFactory.create(ExceptionFactory.java:368)\n\tat o.m.jdbc.message.ClientMessage.readPacket(ClientMessage.java:137)\n\tat o.m.j.c.impl.StandardClient.readPacket(StandardClient.java:819)\n\tat o.m.j.c.impl.StandardClient.readResults(StandardClient.java:758)\n\tat o.m.j.c.impl.StandardClient.readResponse(StandardClient.java:677)\n\tat o.m.j.c.impl.StandardClient.execute(StandardClient.java:620)\n\tat o.m.j.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:93)\n\tat o.m.j.ClientPreparedStatement.execute(ClientPreparedStatement.java:256)\n\tat c.z.h.p.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)\n\tat c.z.h.p.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)\n\tat o.a.i.e.s.PreparedStatementHandler.update(PreparedStatementHandler.java:47)\n\tat o.a.i.e.s.RoutingStatementHandler.update(RoutingStatementHandler.java:74)\n\tat o.a.i.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)\n\tat o.a.i.executor.BaseExecutor.update(BaseExecutor.java:117)\n\t… 2 frames truncated\n\t… 49 common frames omitted\nWrapped by: o.a.i.e.PersistenceException: \n### Error updating database. Cause: java.sql.SQLException: (conn=11992288) Lock wait timeout exceeded; try restarting transaction\n### The error may exist in org/flowable/common/db/mapping/entity/ByteArray.xml\n### The error may involve org.flowable.common.engine.impl.persistence.entity.ByteArrayEntityImpl.bulkInsertByteArray-Inline\n### The error occurred while setting parameters\n### SQL: insert into ACT_GE_BYTEARRAY(ID_, REV_, NAME_, BYTES_, DEPLOYMENT_ID_) values (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, ?, ?) , (?, 1, ?, …”,“tenantId”:“default-tenant”,“correlationId”:“crr-unknown”,“userId”:“anonymousUser”,“sourceChannel”:“ch-unknown”,“transactionId”:“tx-unknown”,“applicationName”:“Order Decomposition Invocation Application”}

This typically means your database is unable to cope with the load you are putting onto it. What kind of database/hardware are you using?

we are using mariaDb and cpu as 2 GB and memory as 2 G
mariadb details

|innodb_version|5.5.61-MariaDB-38.13|
|version|5.5.68-MariaDB|
|version_comment|MariaDB Server|
|version_compile_machine|x86_64|
|version_compile_os|Linux|