Как отладить поток ожидания проблем? - PullRequest
0 голосов
/ 30 ноября 2011

У меня много таких тем в приложении, которое я запускаю.Мне было интересно, как я могу отладить, что происходит не так.

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)

@ Питер, многие из них, похоже, ждут замков

"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 Ответ

0 голосов
/ 03 июля 2012

Не волнуйтесь, кажется, что большинство потоков просто ждут, они будут заняты, когда запросы поступят на ваш сервер Jetty.

Большинство веб-серверов поддерживают пул потоков определенного размера, чтобы не создавать / удалять объекты потоков каждый раз.

Поэтому проверьте конфигурацию Jetty, чтобы увидеть настроенный размер пула потоков и сравнить с количеством ожидающих потоков.

...