Deadlock on EventTypes table with two BPM Suite 6 nodes configured to use same MariaDB InnoDB database

Solution Unverified - Updated -

Environment

  • Red Hat JBoss BPM Suite
    • 6.3

Issue

We have two BPM Suite nodes sharing the same database and when starting a process in both nodes at the same time, see the following issue:

Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Deadlock found when trying to get lock; try restarting transaction
Query is: insert into EventTypes (InstanceId, element) values (?, ?)
Query is:
insert into EventTypes (InstanceId, element) values (?, ?)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:908)
        at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executePreparedQuery(AbstractQueryProtocol.java:349)
        at org.mariadb.jdbc.MariaDbServerPreparedStatement.executeInternal(MariaDbServerPreparedStatement.java:364)
        ... 84 more

The issue seems to be throw when the process reaches a timer node.

Resolution

This is a known issue registered on JIRA RHBPMS-4099. The workaround is drop the foreign key in EventTypes table that references the ProcessInstanceInfo table:

  • Confirm what is the foreign key ID:
SHOW CREATE TABLE EventTypes;

    EventTypes | CREATE TABLE `EventTypes` (
      `InstanceId` bigint(20) NOT NULL,
      `element` varchar(255) DEFAULT NULL,
      KEY `FK_nrecj4617iwxlc65ij6m7lsl1` (`InstanceId`),
      CONSTRAINT `FK_nrecj4617iwxlc65ij6m7lsl1` FOREIGN KEY (`InstanceId`) REFERENCES `ProcessInstanceInfo` (`InstanceId`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  • Drop it:
ALTER TABLE EventTypes DROP FOREIGN KEY FK_nrecj4617iwxlc65ij6m7lsl1;

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments