Deadlock when complete external task

Hi, I noticed that if multiple external tasks are completed simultaneously, it can lead to a deadlock. Is this a normal situation?

Camunda 7.19.0
Mysql 5.7
Springboot 2.7.17 

Here is my BPMN file.
diagram_1.bpmn (8.1 KB)

Here is my java code.

public class InitTask implements JavaDelegate {

    @Override
    public void execute(DelegateExecution execution) throws Exception {
        System.out.println("init task executed");

        execution.setVariable("task1", true);
        execution.setVariable("task2", true);
        execution.setVariable("task3", true);
    }

}
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Service
public class TaskTwo extends BaseTask {

    @Override
    public void execute() {
        System.out.println("task 2 executed " + LocalDateTime.now() + " " + task.getId());
        putWorkflowVariable("task2_finished", true);
    }

}
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Service
public class TaskOne extends BaseTask {

    @Override
    public void execute() {
        System.out.println("task 1 executed " + LocalDateTime.now() + " " + task.getId());
        putWorkflowVariable("task1_finished", true);
    }

}
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@Service
public class TaskThree extends BaseTask {

    @Override
    public void execute() {
        System.out.println("task 3 executed " + LocalDateTime.now() + " " + task.getId());
        putWorkflowVariable("task3_finished", true);
    }

}

I invoke external task complete method after Task execute done.
DealLock is inevitable.

I don’t know how deadlocks are generated.

org.camunda.bpm.engine.ProcessEngineException: An exception occurred in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace.
	at org.camunda.bpm.engine.impl.util.ExceptionUtil.wrapPersistenceException(ExceptionUtil.java:360) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationException(EnginePersistenceLogger.java:137) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:364) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:323) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:295) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:272) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:188) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:119) [camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.lambda$execute$0(SpringTransactionInterceptor.java:71) [camunda-engine-spring-7.19.0.jar:7.19.0]
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.3.30.jar:5.3.30]
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:71) [camunda-engine-spring-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.interceptor.ExceptionCodeInterceptor.execute(ExceptionCodeInterceptor.java:55) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.ExternalTaskServiceImpl.complete(ExternalTaskServiceImpl.java:64) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.ExternalTaskServiceImpl.complete(ExternalTaskServiceImpl.java:59) ~[camunda-engine-7.19.0.jar:7.19.0]
	at com.guoshoujing.compent.Scheduler.lambda$null$1(Scheduler.java:74) ~[classes/:na]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_333]
	at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) ~[na:1.8.0_333]
	at java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_333]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_333]
	at java.lang.Thread.run(Thread.java:750) ~[na:1.8.0_333]
Caused by: org.camunda.bpm.engine.ProcessEngineException: ENGINE-03004 Exception while executing Database Operation 'UPDATE VariableInstanceEntity[028c7a54-abf6-11ef-9367-16e686fb517a]' with message '
### Error updating database.  Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/VariableInstance.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.updateVariableInstance-Inline
### The error occurred while setting parameters
### SQL: update ACT_RU_VARIABLE     set       REV_ = ?,       EXECUTION_ID_ = ?,       VAR_SCOPE_ = ?,       TYPE_ = ?,      BYTEARRAY_ID_ = ?,      DOUBLE_ = ?,      LONG_ = ?,      TEXT_ = ?,      TEXT2_ = ?,       SEQUENCE_COUNTER_ = ?     where ID_ = ?       and REV_ = ?
### Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction'. Flush summary: 
 [
  INSERT HistoricVariableInstanceEntity[0a846d10-abf6-11ef-9367-16e686fb517a]
  INSERT HistoricVariableUpdateEventEntity[0a6217fe-abf6-11ef-9367-16e686fb517a]
  INSERT HistoricVariableUpdateEventEntity[0a846d11-abf6-11ef-9367-16e686fb517a]
  INSERT HistoricVariableUpdateEventEntity[0a849422-abf6-11ef-9367-16e686fb517a]
  INSERT HistoricVariableUpdateEventEntity[0a8de2f4-abf6-11ef-9367-16e686fb517a]
  INSERT HistoricVariableUpdateEventEntity[0a96e3a6-abf6-11ef-9367-16e686fb517a]
  INSERT HistoricExternalTaskLogEntity[0ab233d8-abf6-11ef-9367-16e686fb517a]
  INSERT HistoricActivityInstanceEventEntity[Gateway_07dcdi4:0abba9ba-abf6-11ef-9367-16e686fb517a]
  INSERT VariableInstanceEntity[0a846d10-abf6-11ef-9367-16e686fb517a]
  DELETE ExternalTaskEntity[05ea245c-abf6-11ef-9367-16e686fb517a]
  UPDATE VariableInstanceEntity[028c7a54-abf6-11ef-9367-16e686fb517a]
  UPDATE VariableInstanceEntity[028c7a56-abf6-11ef-9367-16e686fb517a]
  UPDATE VariableInstanceEntity[028c7a58-abf6-11ef-9367-16e686fb517a]
  UPDATE VariableInstanceEntity[06ee9c0f-abf6-11ef-9367-16e686fb517a]
  UPDATE ExecutionEntity[029cf51c-abf6-11ef-9367-16e686fb517a]
  UPDATE ExecutionEntity[01960c5f-abf6-11ef-9367-16e686fb517a]
  DELETE ExecutionEntity[05ea245a-abf6-11ef-9367-16e686fb517a]
  UPDATE HistoricActivityInstanceEventEntity[Activity_1fi0lhz:05ea245b-abf6-11ef-9367-16e686fb517a]
]
	at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.flushDbOperationException(EnginePersistenceLogger.java:136) ~[camunda-engine-7.19.0.jar:7.19.0]
	... 22 common frames omitted
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
### The error may exist in org/camunda/bpm/engine/impl/mapping/entity/VariableInstance.xml
### The error may involve org.camunda.bpm.engine.impl.persistence.entity.VariableInstanceEntity.updateVariableInstance-Inline
### The error occurred while setting parameters
### SQL: update ACT_RU_VARIABLE     set       REV_ = ?,       EXECUTION_ID_ = ?,       VAR_SCOPE_ = ?,       TYPE_ = ?,      BYTEARRAY_ID_ = ?,      DOUBLE_ = ?,      LONG_ = ?,      TEXT_ = ?,      TEXT2_ = ?,       SEQUENCE_COUNTER_ = ?     where ID_ = ?       and REV_ = ?
### Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) ~[mybatis-3.5.6.jar:3.5.6]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199) ~[mybatis-3.5.6.jar:3.5.6]
	at org.camunda.bpm.engine.impl.db.sql.DbSqlSession.executeUpdate(DbSqlSession.java:401) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.sql.SimpleDbSqlSession.updateEntity(SimpleDbSqlSession.java:141) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.AbstractPersistenceSession.executeDbOperation(AbstractPersistenceSession.java:55) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.sql.SimpleDbSqlSession.executeDbOperations(SimpleDbSqlSession.java:60) ~[camunda-engine-7.19.0.jar:7.19.0]
	at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:341) ~[camunda-engine-7.19.0.jar:7.19.0]
	... 21 common frames omitted
Caused by: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:123) ~[mysql-connector-java-8.0.28.jar:8.0.28]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.28.jar:8.0.28]
	at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) ~[mysql-connector-java-8.0.28.jar:8.0.28]
	at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:371) ~[mysql-connector-java-8.0.28.jar:8.0.28]
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44) ~[HikariCP-4.0.3.jar:na]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:na]
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) ~[mybatis-3.5.6.jar:3.5.6]
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) ~[mybatis-3.5.6.jar:3.5.6]
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) ~[mybatis-3.5.6.jar:3.5.6]
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.5.6.jar:3.5.6]
	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.5.6.jar:3.5.6]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ~[mybatis-3.5.6.jar:3.5.6]
	... 26 common frames omitted

Additionally, I would like to know if the external tasks still need to have asynchronous continuation enabled?