title: Weblogic Stuck Thread on JDBC call
body: <p>We frequently get a series of Stuck threads on our Weblogic servers. I've analyzed this over a period of time.</p>
  
  <p>What I'd like to understand is whether this stuck thread block indicates <em>it is still reading data from the open socket to the database</em> since the queries are simple SELECT stuff?</p>
  
  <pre><code>at java.net.SocketInputStream.socketRead0(Native Method)
          at java.net.SocketInputStream.read(SocketInputStream.java:129)
          at oracle.net.ns.Packet.receive(Packet.java:239)
          at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
  </code></pre>
  
  <p>We've run netstat and other commands, the sockets from the Weblogic app server to the Database match the number of connections in the pool.  </p>
  
  <p>Any ideas what else we should be investigating here?</p>
  
  <p><strong>Stack trace of thread dump:</strong> </p>
  
  <pre><code>"[STUCK] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon prio=10 tid=0x61a5b000 nid=0x25f runnable [0x6147b000..0x6147eeb0]
     java.lang.Thread.State: RUNNABLE
          at java.net.SocketInputStream.socketRead0(Native Method)
          at java.net.SocketInputStream.read(SocketInputStream.java:129)
          at oracle.net.ns.Packet.receive(Packet.java:239)
          at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
          at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:172)
          at oracle.net.ns.NetInputStream.read(NetInputStream.java:117)
          at oracle.net.ns.NetInputStream.read(NetInputStream.java:92)
          at oracle.net.ns.NetInputStream.read(NetInputStream.java:77)
          at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1023)
          at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:999)
          at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:584)
          at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:183)
          at oracle.jdbc.driver.T4CStatement.fetch(T4CStatement.java:1000)
          at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:314)
          - locked &lt;0x774546e0&gt; (a oracle.jdbc.driver.T4CConnection)
          at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:228)
          - locked &lt;0x774546e0&gt; (a oracle.jdbc.driver.T4CConnection)
          at weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_OracleResultSetImpl.next(Unknown Source)
  </code></pre>
  
  <p>The bit starting from <code>weblogic.work.ExecuteThread.run</code> to here has been omitted. We have 8 sets of thread dumps - and each show the thread waiting on the same line, and the same object locked</p>
  
  <pre><code>at oracle.jdbc.driver.OracleResultSetImpl.close_or_fetch_from_next(OracleResultSetImpl.java:314)
          - locked &lt;0x774546e0&gt; (a oracle.jdbc.driver.T4CConnection)
  </code></pre>