Reputation: 1007
Env: Tomcat 5.x on Java 1.5.x on Windows using OracleJDBC driver on Oracle 9i
The problem: I have a thread which is in RUNNABLE state. It doesn't seem to complete -ever.
How do I investigate this further ? This is reproducible quite easily.
This thread is basically trying to insert some data
Update: This insert is happening in a synchronized block
This is what I got from the thread dump...
"http-9080-Processor24" daemon prio=6 tid=0x0b20bc00 nid=0x1274 runnable [0x0d55e000..0x0d55fc94]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at oracle.net.ns.Packet.receive(Unknown Source)
at oracle.net.ns.DataPacket.receive(Unknown Source)
at oracle.net.ns.NetInputStream.getNextPacket(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.net.ns.NetInputStream.read(Unknown Source)
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1099)
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1070)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:478)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10580)
- locked <0x02c10078> (a oracle.jdbc.driver.T4CPreparedStatement)
- locked <0x03dceb08> (a oracle.jdbc.driver.T4CConnection)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:294)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
Upvotes: 0
Views: 2353
Reputation: 2955
One of the reasons why the batch statement may not return is because of locks on table - held because the changes were not properly committed by previous running queries.
If that is the case - you should review the code where all autoCommit(true) / autoCommit(false) has been set and if rollback has been used in exception handling clauses and commit otherwise.
You could also check the profile dump from Visual VM tool - that comes in handy while doing testing for a running application in development env. It gives a complete drill down of method call execution.
Upvotes: 0
Reputation: 139991
Looks like your application is executing oracle.jdbc.driver.OraclePreparedStatement.executeBatch()
, which seems to be waiting (forever?) for a NetInputStream to actually return something.
So, is it possible the query/statement being run is never returning? Is it possible your database is hanging? Or it could be possible you've encountered some sort of bug in the Oracle JDBC driver - are you on the most up-to-date version?
You should probably also check if your JDBC driver allows you to specify configurations for connection/query timeouts, etc, to prevent the driver for waiting forever and ever.
Upvotes: 2
Reputation: 507
RN:
If you have a java core dump file, did you try to use HPROF tools from Java SE 5 ? I usually used this tool as a simple way to find out where a problem was in the source codes. If it does not help, I will probably use a profiler tool. Please correct me if it is wrong for your question.
I hope it helps.
Tiger.
Upvotes: 0