2011-11-30 132 views
0

我在運行一個碼頭應用程序中有很多這樣的線程。我想知道我該如何調試出錯的地方。如何調試線程等待問題?

2011-11-30 18:25:52 
Full thread dump OpenJDK Client VM (19.0-b09 mixed mode, sharing): 

"pool-34193-thread-1" prio=10 tid=0xac634800 nid=0x515 waiting on condition [0xaaf2c000] 
    java.lang.Thread.State: TIMED_WAITING (parking) 
    at sun.misc.Unsafe.park(Native Method) 
    - parking to wait for <0x6429b8c0> (a java.util.concurrent.SynchronousQueue$TransferStack) 
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:453) 
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:352) 
    at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:903) 
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:636) 

"pool-34189-thread-1" prio=10 tid=0xac3f8400 nid=0x512 waiting on condition [0xaf766000] 
    java.lang.Thread.State: TIMED_WAITING (parking) 
    at sun.misc.Unsafe.park(Native Method) 
    - parking to wait for <0x64177778> (a java.util.concurrent.SynchronousQueue$TransferStack) 
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:453) 
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:352) 
    at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:903) 
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:636) 

"pool-34187-thread-1" prio=10 tid=0xac63c800 nid=0x511 waiting on condition [0xab349000] 
    java.lang.Thread.State: TIMED_WAITING (parking) 
    at sun.misc.Unsafe.park(Native Method) 
    - parking to wait for <0x64f78728> (a java.util.concurrent.SynchronousQueue$TransferStack) 
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:453) 
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:352) 
    at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:903) 
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:636) 

"pool-34176-thread-1" prio=10 tid=0xac630000 nid=0x510 waiting on condition [0xab48d000] 
    java.lang.Thread.State: TIMED_WAITING (parking) 
    at sun.misc.Unsafe.park(Native Method) 
    - parking to wait for <0x6421b7e8> (a java.util.concurrent.SynchronousQueue$TransferStack) 
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 
    at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:453) 
    at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:352) 
    at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:903) 
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 
    at java.lang.Thread.run(Thread.java:636) 

@Peter, 他們中的很多似乎在等待鎖

"qtp26356569-17296" prio=10 tid=0xb3c09800 nid=0x2932 waiting on condition [0x9c762000] 
java.lang.Thread.State: TIMED_WAITING (parking) 
at sun.misc.Unsafe.park(Native Method) 
- parking to wait for <0x714e4798> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) 
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2081) 
at org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:320) 
at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoll(QueuedThreadPool.java:512) 
at org.eclipse.jetty.util.thread.QueuedThreadPool.access$600(QueuedThreadPool.java:38) 
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:558) 
at java.lang.Thread.run(Thread.java:636) 
+1

請給我們完整的線程轉儲請(可能是匿名)。也請看[tda](http://java.net/projects/tda) –

+1

你爲什麼認爲事情出錯了?看起來你有很多無關的線程(等待傳入的請求) –

回答

0

別擔心,似乎大部分線程只是在等待的,他們會變得繁忙時要求到達您的Jetty服務器。

大多數Web服務器都保持一定大小的線程池,以免每次創建/刪除線程對象。

因此,檢查您的Jetty配置以查看您的線程池的配置大小,並與等待的線程數進行比較。