0 Replies Latest reply on Jul 8, 2019 2:55 PM by user11209215

    Stopping a thread which is stuck in jdbc call in socketRead0

    user11209215

      Hello,

       

      I implemented a JMX method which interrupt / stop a thread and it works in a quite of the cases.

      The most important exception is when a thread stuck doing JDBC call and is busy in socketRead0.

       

      We have a job component which is handling a message and finally execute an SQL statement.

      Depends on the input this SQL statement could take significiantly long time. Sometimes it is long for a good reason, sometimes it is not. Therefore setting a timeout upfront is not possible.

       

      When it is considered unreasonably long, then technical admin could decide to stop this thread via JMX without restarting the whole application.

       

      The issue is that Thread.interrupt / stop has no effect when the thread is here:

       

      Stack:

         java.net.SocketInputStream.socketRead0(Native Method)

         java.net.SocketInputStream.socketRead(SocketInputStream.java:116)

         java.net.SocketInputStream.read(SocketInputStream.java:170)

         java.net.SocketInputStream.read(SocketInputStream.java:141)

         oracle.net.ns.Packet.receive(Packet.java:311)

         oracle.net.ns.DataPacket.receive(DataPacket.java:105)

         oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:305)

      ...

       

      Does oracle JDBC driver have something to pop out the thread from the socketRead0 besides the timeout?