[CONJ-864] includeThreadDumpInDeadlockExceptions always includes the thread dump, even when it is not a deadlock exception Created: 2021-03-16  Updated: 2021-05-12  Resolved: 2021-04-22

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 2.7.2
Fix Version/s: 2.7.3, 3.0.0

Type: Bug Priority: Major
Reporter: Mauro Molinari Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

When the option includeThreadDumpInDeadlockExceptions is set to true, any SQL exception causes a thread dump to be added to the exception message.

org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.buildMsgText(String, long, Options, Exception) does this:

if (options != null
        && options.includeInnodbStatusInDeadlockExceptions
        && deadLockException != null) {
      msg.append("\ndeadlock information: ").append(deadLockException);
}
 
if (options != null && options.includeThreadDumpInDeadlockExceptions) {
  // append thread dump
}

I'm not confident with this code, but I suspect that the second block should also be executed only if deadLockException != null.



 Comments   
Comment by Diego Dupin [ 2021-03-22 ]

right, problem reside in includeInnodbStatusInDeadlockExceptions testing deadlock exception, but not includeThreadDumpInDeadlockExceptions

Generated at Thu Feb 08 03:18:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.