[CONJ-23] JVM does not exit after applying query timeout to a statement Created: 2013-02-13  Updated: 2013-02-13  Resolved: 2013-02-13

Status: Closed
Project: MariaDB Connector/J
Component/s: None
Affects Version/s: 1.1.0
Fix Version/s: 1.1.1

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None
Environment:

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.5) (6b24-1.11.5-0ubuntu1~11.10.1)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)


Issue Links:
Relates

 Description   

The following test hangs forever if it is executed with MariaDB Java client. With MySQL Connector/J it works all right.
It does not matter whether the timeout is actually reached or not.
Adding stmt.close() also does not help.
Please note that the same code executed via JUnit does not hang.

import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
 
public class QueryTimeout
{
  public static void main (String argv[])	
  {
    String dsn = "jdbc:mysql://localhost:3306/test?user=root";
    try {
      Connection conn = DriverManager.getConnection(dsn);
      Statement stmt = conn.createStatement();
      stmt.setQueryTimeout(1);
      stmt.execute("select 1");
      conn.close();
    } catch (Exception e) {
        e.printStackTrace();
      }
  } 
}

revision-id: wlad@montyprogram.com-20130212213004-52xak8ynair4uct4
revno: 406
branch-nick: mariadb-java-client

jstack output:

Full thread dump OpenJDK 64-Bit Server VM (20.0-b12 mixed mode):
 
"Attach Listener" daemon prio=10 tid=0x00000000015d7800 nid=0x6a3b runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
 
   Locked ownable synchronizers:
	- None
 
"DestroyJavaVM" prio=10 tid=0x00007ff01c0df000 nid=0x6a1c waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
 
   Locked ownable synchronizers:
	- None
 
"Timer-0" prio=10 tid=0x00007ff01c0de800 nid=0x6a28 in Object.wait() [0x00007ff02362d000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00000000eb6f4880> (a java.util.TaskQueue)
	at java.lang.Object.wait(Object.java:502)
	at java.util.TimerThread.mainLoop(Timer.java:505)
	- locked <0x00000000eb6f4880> (a java.util.TaskQueue)
	at java.util.TimerThread.run(Timer.java:484)
 
   Locked ownable synchronizers:
	- None
 
"Low Memory Detector" daemon prio=10 tid=0x00007ff01c004800 nid=0x6a25 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
 
   Locked ownable synchronizers:
	- None
 
"C2 CompilerThread1" daemon prio=10 tid=0x00007ff01c002000 nid=0x6a24 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
 
   Locked ownable synchronizers:
	- None
 
"C2 CompilerThread0" daemon prio=10 tid=0x0000000001669800 nid=0x6a23 waiting on condition [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
 
   Locked ownable synchronizers:
	- None
 
"Signal Dispatcher" daemon prio=10 tid=0x0000000001668800 nid=0x6a22 runnable [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
 
   Locked ownable synchronizers:
	- None
 
"Finalizer" daemon prio=10 tid=0x0000000001649800 nid=0x6a21 in Object.wait() [0x00007ff0246a1000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00000000eb561310> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133)
	- locked <0x00000000eb561310> (a java.lang.ref.ReferenceQueue$Lock)
	at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149)
	at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:177)
 
   Locked ownable synchronizers:
	- None
 
"Reference Handler" daemon prio=10 tid=0x0000000001642000 nid=0x6a20 in Object.wait() [0x00007ff0247a2000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00000000eb5611e8> (a java.lang.ref.Reference$Lock)
	at java.lang.Object.wait(Object.java:502)
	at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
	- locked <0x00000000eb5611e8> (a java.lang.ref.Reference$Lock)
 
   Locked ownable synchronizers:
	- None
 
"VM Thread" prio=10 tid=0x000000000163b000 nid=0x6a1f runnable 
 
"GC task thread#0 (ParallelGC)" prio=10 tid=0x00000000015e2800 nid=0x6a1d runnable 
 
"GC task thread#1 (ParallelGC)" prio=10 tid=0x00000000015e4000 nid=0x6a1e runnable 
 
"VM Periodic Task Thread" prio=10 tid=0x00007ff01c007000 nid=0x6a26 waiting on condition 
 
JNI global references: 878


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