[GitHub] activemq-artemis pull request #1622: ARTEMIS-1485 ActiveMQTestBase.threadDum...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis pull request #1622: ARTEMIS-1485 ActiveMQTestBase.threadDum...

pgfox
GitHub user dudaerich opened a pull request:

    https://github.com/apache/activemq-artemis/pull/1622

    ARTEMIS-1485 ActiveMQTestBase.threadDump should print information about locks and deadlocks

    Improved implementation of ActiveMQTestBase.threadDump which uses ThreadMXBean
    for getting information about threads including locks and deadlocks.
   
    Sample of the thread dump
   
    ```
    Complete Thread dump  - fired by MultiThreadRandomReattachTestBase::runTestMultipleThreads (AMQ119014: Timed out after waiting 30,000 ms for response when sending packet 105)
    "Thread-4 (ActiveMQ-scheduled-threads)" Id=183 WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@2dc00c99
    at sun.misc.Unsafe.park(Native Method)
    -  waiting on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@2dc00c99
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1088)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
   
    "Thread-34 (ActiveMQ-remoting-threads-ActiveMQServerImpl::serverUUID=1a0105d4-bd4f-11e7-973f-fa163e2a7ec6-440938038)" Id=160 WAITING on java.util.concurrent.CountDownLatch$Sync@41e2c73f
    at sun.misc.Unsafe.park(Native Method)
    -  waiting on java.util.concurrent.CountDownLatch$Sync@41e2c73f
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
    at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
    at org.apache.activemq.artemis.utils.SimpleFutureImpl.get(SimpleFutureImpl.java:62)
    at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.transferConnection(ServerSessionPacketHandler.java:911)
    at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handleReattachSession(ActiveMQPacketHandler.java:242)
    at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQPacketHandler.handlePacket(ActiveMQPacketHandler.java:103)
    at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:638)
    at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:392)
    -  locked java.lang.Object@1409cb91
    at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:374)
    at org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:642)
    at org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:196)
    at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:42)
    at org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:31)
    at org.apache.activemq.artemis.utils.actors.ProcessorBase$ExecutorTask.run(ProcessorBase.java:53)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:748)
   
    Number of locked synchronizers = 1
    - java.util.concurrent.ThreadPoolExecutor$Worker@1f764375
   
    ===============================================================================
    End Thread dump  - fired by MultiThreadRandomReattachTestBase::runTestMultipleThreads (AMQ119014: Timed out after waiting 30,000 ms for response when sending packet 105)
    *******************************************************************************
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dudaerich/activemq-artemis ARTEMIS-1485

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/1622.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1622
   
----
commit 726158d77fe2bdf4890586ee4435f93f5ad42852
Author: Erich Duda <[hidden email]>
Date:   2017-10-30T08:41:23Z

    ARTEMIS-1485 ActiveMQTestBase.threadDump should print information about locks and deadlocks
   
    Improved implementation of ActiveMQTestBase.threadDump which uses ThreadMXBean
    for getting information about threads including locks and deadlocks.

----


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis pull request #1622: ARTEMIS-1485 ActiveMQTestBase.threadDum...

pgfox
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1622#discussion_r147885701
 
    --- Diff: artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java ---
    @@ -619,34 +623,107 @@ public static void checkWeakReferences(final WeakReference<?>... references) {
        }
     
        public static String threadDump(final String msg) {
    -      StringWriter str = new StringWriter();
    -      PrintWriter out = new PrintWriter(str);
     
    -      Map<Thread, StackTraceElement[]> stackTrace = Thread.getAllStackTraces();
    +      try (
    --- End diff --
   
    Hmmmm... now that you have something complete like this.. we need to think of a way to reuse this logic into ActiveMQServerImpl::threadDump


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis pull request #1622: ARTEMIS-1485 ActiveMQTestBase.threadDum...

pgfox
In reply to this post by pgfox
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1622#discussion_r147885786
 
    --- Diff: artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java ---
    @@ -619,34 +623,107 @@ public static void checkWeakReferences(final WeakReference<?>... references) {
        }
     
        public static String threadDump(final String msg) {
    -      StringWriter str = new StringWriter();
    -      PrintWriter out = new PrintWriter(str);
     
    -      Map<Thread, StackTraceElement[]> stackTrace = Thread.getAllStackTraces();
    +      try (
    --- End diff --
   
    Perhaps add a class into util: String ThreadDumpUtil.threadDump()
   
    And call this on both places?
   
   
    Do you want to take care of this, or should I do it?


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis pull request #1622: ARTEMIS-1485 ActiveMQTestBase.threadDum...

pgfox
In reply to this post by pgfox
Github user dudaerich commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1622#discussion_r147902224
 
    --- Diff: artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java ---
    @@ -619,34 +623,107 @@ public static void checkWeakReferences(final WeakReference<?>... references) {
        }
     
        public static String threadDump(final String msg) {
    -      StringWriter str = new StringWriter();
    -      PrintWriter out = new PrintWriter(str);
     
    -      Map<Thread, StackTraceElement[]> stackTrace = Thread.getAllStackTraces();
    +      try (
    --- End diff --
   
    Thanks for review. I will do it.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis issue #1622: ARTEMIS-1485 ActiveMQTestBase.threadDump shoul...

pgfox
In reply to this post by pgfox
Github user dudaerich commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1622
 
    @clebertsuconic I've updated the PR. Please check.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis issue #1622: ARTEMIS-1485 ActiveMQTestBase.threadDump shoul...

pgfox
In reply to this post by pgfox
Github user dudaerich commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1622
 
    The ActiveMQServerImpl::threadDump used following methods when generating the thread dump. Not sure if I can just omit them. If yes these methods can be removed as they are not used anymore. Wdyt?
   
    ```java
    @MessageBundle(projectCode = "AMQ")
    public interface ActiveMQMessageBundle {
       @Message(id = 119001, value = "Generating thread dump", format = Message.Format.MESSAGE_FORMAT)
       String generatingThreadDump();
   
       @Message(id = 119002, value = "Thread {0} name = {1} id = {2} group = {3}", format = Message.Format.MESSAGE_FORMAT)
       String threadDump(Thread key, String name, Long id, ThreadGroup threadGroup);
   
       @Message(id = 119003, value = "End Thread dump")
       String endThreadDump();
    ```


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis issue #1622: ARTEMIS-1485 ActiveMQTestBase.threadDump shoul...

pgfox
In reply to this post by pgfox
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1622
 
    I never liked having these constants there.. just use constants there.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis issue #1622: ARTEMIS-1485 ActiveMQTestBase.threadDump shoul...

pgfox
In reply to this post by pgfox
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1622
 
    @dudaerich looks great! thanks!


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] activemq-artemis pull request #1622: ARTEMIS-1485 ActiveMQTestBase.threadDum...

pgfox
In reply to this post by pgfox
Github user asfgit closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/1622


---