Bug #43310 | Transaction rollback (because of a deadlock) doesn't throw an Exception | ||
---|---|---|---|
Submitted: | 2 Mar 2009 16:42 | Modified: | 31 Mar 2014 15:19 |
Reporter: | Michael Fink | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | OS: | Linux | |
Assigned to: | Alexander Soklakov | CPU Architecture: | Any |
Tags: | deadlock, exception, hang, transaction |
[2 Mar 2009 16:42]
Michael Fink
[2 Mar 2009 17:14]
Tonci Grgin
Hi Michael and thanks for your report. I do not see a test case attached nor, to be hones, do I see a bug here... When storage engine returns error 'deadlock found. please restart transaction' you have exception in your program (SQLException, with a SQLState that starts with "08" to be precise). When read hangs until other transaction(s) commit, connector is helpless. One can only set timeout in this case.
[3 Mar 2009 13:20]
Michael Fink
Tonci, I think my interpretation and description of the problem was wrong. Let me explain it again: I've got two transactions in a deadlock situation. The first txn tries to INSERT and the second tries to SELECT some values. The DBMS recognizes the deadlock and decides to rollback the second txn. Now from the applications point of view the method executeQuery() should return for the first tnx a ResultSet and for the second tnx it should throw an exception. My problem is that sometimes executeQuery() for the second txn neither returns nor throws an exception. The root cause seems to be the SocketInputStream.socketRead0 method which never returns (see my stacktrace). The problem sporadically occurs only when the txn was rolled back by the DBMS. Do you agree with me that this is unexpected behavior? Regards, Michael
[4 Mar 2009 9:34]
Tonci Grgin
Michael, without repeatable test case I can not agree on anything so please attach a complete one. > My problem is that sometimes executeQuery() for the second txn neither returns nor throws an exception. The root cause seems to be the SocketInputStream.socketRead0 method which never returns (see my stacktrace). The problem sporadically occurs only when the txn was rolled back by the DBMS. Without test case I can't say more than I already said. Please check that transaction 2 was actually beaked in execution either by looking into general query log or WireShark or both. Reading such problem from stack traces is almost impossible.
[4 Apr 2009 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[17 Nov 2009 13:01]
Tonci Grgin
Michael, it would be most interesting to see test case *and* stack trace of MySQL server at the time of hang. If I remember correctly, gdb has something like "thread apply all bt" that you can use. We are actually wondering at what client is waiting on...
[17 Nov 2009 13:03]
Tonci Grgin
Shyamsundar, why are your comments private? If there is nothing confidential in them, please remove the private flag so others can see.
[18 Dec 2009 0:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[19 Dec 2009 12:21]
shyamsundar reddy
This bug occurs, if the any of the belowed tables have indexed columns and a lock is done on indexes.
[24 Aug 2010 11:32]
Tonci Grgin
Even though nobody bothered to attach a test case nor even table structures, I'm reopening this for further analysis.
[3 Feb 2011 10:01]
Tonci Grgin
Shyamsundar, your problem is described somewhere in BugsDB (I remember seeing it) tied to InnoDB. Please look for it.
[3 Feb 2011 10:03]
Tonci Grgin
@Michael: Michael, it would be most interesting to see test case *and* stack trace of MySQL server at the time of hang. If I remember correctly, gdb has something like "thread apply all bt" that you can use. We are actually wondering at what client is waiting on... Until such time this info is attached, and with no test case, I'm powerless.
[4 Mar 2011 0:01]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[31 Mar 2014 15:19]
Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and several serious changes of c/J synchronization model were introduced since time this bug reported. Please, feel free to reopen it if the problem still exists in current driver.