我的Java程序在调用oracle.jdbc.pool.OracleOCIConnectionPool.getConnection几分钟后冻结

时间:2011-01-12 23:17:53

标签: java connection-pooling oracle11g

我有一个连接到oracle 11g的Java应用程序。该过程以oracle.jdbc.pool.OracleOCIConnectionPool.getConnection方法冻结2到3分钟。它确实设法获得连接并在3分钟后继续没有任何错误。

奇怪的是,当连接到同一个数据库时,同一程序在不同的机器上运行良好。

我无法弄清楚这里发生了什么。任何人都可以帮我解决这个问题吗?

下面是示例程序在getConnection方法停留时的线程转储:

Full thread dump Java HotSpot(TM) Server VM (1.5.0_11-b03 mixed mode):

"Thread-9" prio=10 tid=0x00431a60 nid=0x24 runnable [0xaffff000..0xaffffb70]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-8" prio=10 tid=0x00430e50 nid=0x23 runnable [0xb00ff000..0xb00ff9f0]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-7" prio=10 tid=0x00460490 nid=0x22 runnable [0xb01ff000..0xb01ffa70]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-6" prio=10 tid=0x00249320 nid=0x21 runnable [0xb02ff000..0xb02ff8f0]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-5" prio=10 tid=0x000b7910 nid=0x20 runnable [0xb03ff000..0xb03ff970]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-4" prio=10 tid=0x000b7128 nid=0x1f runnable [0xb04ff000..0xb04ffbf0]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-3" prio=10 tid=0x00126a50 nid=0x1e runnable [0xb05ff000..0xb05ffc70]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-2" prio=10 tid=0x0058bc38 nid=0x1d runnable [0xb06ff000..0xb06ffaf0]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Thread-1" prio=10 tid=0x00125d90 nid=0x1c runnable [0xb07ff000..0xb07ffb70]
        at java.lang.Thread.yield(Native Method)
        at conPoolAppl.run(conPoolAppl.java:101)

"Low Memory Detector" daemon prio=10 tid=0x001c5f50 nid=0x19 runnable [0x00000000..0x00000000]

"CompilerThread1" daemon prio=10 tid=0x001c4de8 nid=0x18 waiting on condition [0x00000000..0xb347e8b4]

"CompilerThread0" daemon prio=10 tid=0x001c3f70 nid=0x17 waiting on condition [0x00000000..0xb357e93c]

"AdapterThread" daemon prio=10 tid=0x001c30f8 nid=0x16 waiting on condition [0x00000000..0x00000000]

"Signal Dispatcher" daemon prio=10 tid=0x001c2388 nid=0x15 waiting on condition [0x00000000..0x00000000]

"Finalizer" daemon prio=10 tid=0x001b5b80 nid=0x14 in Object.wait() [0xb387f000..0xb387faf0]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xe30006d8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
        - locked <0xe30006d8> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
        at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)

"Reference Handler" daemon prio=10 tid=0x001b4e38 nid=0x13 in Object.wait() [0xb397f000..0xb397fb70]
        at java.lang.Object.wait(Native Method)
        - waiting on <0xe30005e8> (a java.lang.ref.Reference$Lock)
        at java.lang.Object.wait(Object.java:474)
        at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
        - locked <0xe30005e8> (a java.lang.ref.Reference$Lock)

"main" prio=10 tid=0x00036898 nid=0x1 runnable [0xffbfc000..0xffbfcf30]
        at oracle.jdbc.driver.T2CConnection.t2cConnPoolLogon(Native Method)
        at oracle.jdbc.driver.T2CConnection.processOCIConnectionPooling(T2CConnection.java:1103)
        at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:258)
        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
        at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:148)
        at oracle.jdbc.driver.OracleOCIConnection.<init>(OracleOCIConnection.java:60)
        at oracle.jdbc.driver.OracleOCIConnection.<init>(OracleOCIConnection.java:44)
        at oracle.jdbc.oci.OracleOCIConnection.<init>(OracleOCIConnection.java:35)
        at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:49)
        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
        at oracle.jdbc.pool.OracleOCIConnectionPool.getConnection(OracleOCIConnectionPool.java:244)
        - locked <0xe3272a78> (a oracle.jdbc.pool.OracleOCIConnectionPool)
        at conPoolAppl.main(conPoolAppl.java:47)

"VM Thread" prio=10 tid=0x001b2d58 nid=0x12 runnable

"GC task thread#0 (ParallelGC)" prio=10 tid=0x000b8148 nid=0x2 runnable

"GC task thread#1 (ParallelGC)" prio=10 tid=0x000b8b88 nid=0x3 runnable

"GC task thread#2 (ParallelGC)" prio=10 tid=0x000b95c8 nid=0x4 runnable

"GC task thread#3 (ParallelGC)" prio=10 tid=0x000ba008 nid=0x5 runnable

"GC task thread#4 (ParallelGC)" prio=10 tid=0x000baa48 nid=0x6 runnable

"GC task thread#5 (ParallelGC)" prio=10 tid=0x000bb488 nid=0x7 runnable

"GC task thread#6 (ParallelGC)" prio=10 tid=0x000bbee0 nid=0x8 runnable

"GC task thread#7 (ParallelGC)" prio=10 tid=0x000bd128 nid=0x9 runnable

"GC task thread#8 (ParallelGC)" prio=10 tid=0x000bdb68 nid=0xa runnable

"GC task thread#9 (ParallelGC)" prio=10 tid=0x000be5a8 nid=0xb runnable

"GC task thread#10 (ParallelGC)" prio=10 tid=0x000befe8 nid=0xc runnable

"GC task thread#11 (ParallelGC)" prio=10 tid=0x000bfa28 nid=0xd runnable

"GC task thread#12 (ParallelGC)" prio=10 tid=0x000c0468 nid=0xe runnable

"GC task thread#13 (ParallelGC)" prio=10 tid=0x000c0ea8 nid=0xf runnable

"GC task thread#14 (ParallelGC)" prio=10 tid=0x000c18e8 nid=0x10 runnable

"GC task thread#15 (ParallelGC)" prio=10 tid=0x000c2328 nid=0x11 runnable

"VM Periodic Task Thread" prio=10 tid=0x001c71e0 nid=0x1a waiting on condition

1 个答案:

答案 0 :(得分:0)

使用ltrace&amp; strace(linux)或truss&amp; dtrace(solaris)查看本机代码正在做什么。