Bug #94350 | JDBC deadlocks occurs with autocommit=off and DDL after DML | ||
---|---|---|---|
Submitted: | 15 Feb 2019 16:18 | Modified: | 13 Sep 2019 9:30 |
Reporter: | Petr Chudanic | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | OS: | Any | |
Assigned to: | CPU Architecture: | Any |
[15 Feb 2019 16:18]
Petr Chudanic
[15 Feb 2019 16:20]
Petr Chudanic
Apology for the wording - I do not know if it is the deadlock, only that the executions hangs in the driver
[6 Mar 2019 8:38]
Alexander Soklakov
Hi Petr, Which driver and server versions do you use?
[13 Mar 2019 8:17]
Petr Chudanic
reproduced on version 8.0.11 with driver mysql-connector-java-8.0.12.jar version 5.7.11 with driver mysql-connector-java-5.1.40-bin.jar version 5.7.11 with driver mysql-connector-java-5.1.46.jar version 5.7.11 with driver mysql-connector-java-8.0.12.jar I haven't tried more but seems like common issue
[13 Sep 2019 9:30]
Alexander Soklakov
Hi Petr, It's not a bug. The DELETE transaction is waiting for SELECT transaction cmpletion to acquire the exclusive lock on the table. As mentioned on https://dev.mysql.com/doc/refman/8.0/en/innodb-autocommit-commit-rollback.html "If autocommit mode is disabled within a session with SET autocommit = 0, the session always has a transaction open. A COMMIT or ROLLBACK statement ends the current transaction and a new one starts." So you should either issue statement.execute("COMMIT") or do dbConnection.commit() after reading all results from SELECT if you can't close the connection.