Wednesday, 23 March 2011

How to Collect Thread dump for Oracle Applications - In this Case B2B 10g in Linux.

The command to perform a thread dump on linux is kill -3 <pid>. 


The <pid> can be found using opmnctl status for the midtier. 


Example of the output:


-------------------+--------------------+---------+---------
ias-component      | process-type       |     pid | status -------------------+--------------------+---------+---------
LogLoader          | logloaderd         |     N/A | Down   dcm-daemon         | dcm-daemon         |     N/A | Down   OC4J               | home               |    1648 | Alive  HTTP_Server        | HTTP_Server        |    1646 | Alive  B2B                | B2BServer          |    1647 | Alive  B2B                | OC4J_B2B           |    1649 | Alive  DSA                | DSA                |     N/A | Down   


In the above example, the <pid> is 1647.


The thread dumps are located in file $ORACLE_HOME/opmn/logs/B2B~B2BServer~*  or B2B~OC4J_B2B~* file. 


This needs to be done a least three times at interval about 15-30 seconds each after the issue (what ever you are debugging) has been re-produced. 


Example of a thread dump:


Full thread dump Java HotSpot(TM) Server VM (1.4.2_14-b05 mixed mode):

"Thread-9" prio=1 tid=0x088d0110 nid=0x22b8 runnable [0x857ab000..0x857ac228]
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(SocketInputStream.java:129)
       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:978)
       at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:950)
       at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:447)
       at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:183)
       at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:872)
       at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)
       at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3000)
       at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3042)
       - locked <0x91feaae8> (a oracle.jdbc.driver.T4CCallableStatement)
       - locked <0x91e29b38> (a oracle.jdbc.driver.T4CConnection)
       at oracle.jms.AQjmsConsumer.dequeue(AQjmsConsumer.java:1601)
       at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:922)
       at oracle.jms.AQjmsConsumer.receiveFromAQ(AQjmsConsumer.java:835)
       at oracle.jms.AQjmsConsumer.receive(AQjmsConsumer.java:776)
       at oracle.tip.adapter.b2b.data.MsgListener.run(MsgListener.java:366)
       at java.lang.Thread.run(Thread.java:534) 

1 comment: