You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by clebertsuconic <gi...@git.apache.org> on 2018/02/26 18:28:43 UTC

[GitHub] activemq-artemis pull request #1899: ARTEMIS-1700 Fixed deadlock in paging s...

GitHub user clebertsuconic opened a pull request:

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

    ARTEMIS-1700 Fixed deadlock in paging state

    This closes #1894

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

    $ git pull https://github.com/clebertsuconic/activemq-artemis deadlock

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

    https://github.com/apache/activemq-artemis/pull/1899.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 #1899
    
----
commit a4c0e9bcdf072404c07816fd8fe3e8402a774382
Author: Clebert Suconic <cl...@...>
Date:   2018-02-26T18:13:50Z

    ARTEMIS-1700 Fixed deadlock in paging state
    
    This closes #1894

----


---

[GitHub] activemq-artemis issue #1899: ARTEMIS-1700 Fixed deadlock in paging state

Posted by shoukunhuai <gi...@git.apache.org>.
Github user shoukunhuai commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1899
  
    So it is a mistake to use global thread pool instead of io thread pool for page cursor.
    
    But this does not fix our problem, as you can see 
    ```
    "Thread-274672 (ActiveMQ-server-org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl$5@4e91d63f)" Id=274703 TIMED_WAITING on java.util.concurrent.CountDownLatch$Sync@5c416651
    	at sun.misc.Unsafe.park(Native Method)
    	-  waiting on java.util.concurrent.CountDownLatch$Sync@5c416651
    	at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037)
    	at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)
    	at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:277)
    	at org.apache.activemq.artemis.core.journal.impl.SimpleWaitIOCallback.waitCompletion(SimpleWaitIOCallback.java:73)
    	at org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl.waitCompletion(OperationContextImpl.java:313)
    	at org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager.waitOnOperations(AbstractJournalStorageManager.java:294)
    	at org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl.storeBookmark(PageCursorProviderImpl.java:539)
    	at org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl.cleanupComplete(PageCursorProviderImpl.java:431)
    	at org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl.cleanup(PageCursorProviderImpl.java:383)
    	-  locked org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl@4f8d6d9a
    	at org.apache.activemq.artemis.core.paging.cursor.impl.PageCursorProviderImpl$1.run(PageCursorProviderImpl.java:291)
    	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:745)
    
    	Number of locked synchronizers = 2
    	- java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@613d010
    	- java.util.concurrent.ThreadPoolExecutor$Worker@4c03ae59
    ```
    When exit paging state, we will store bookmark for each page subscription and wait until all callbacks done.
    I believe this may happen even running in io thread as long as singleThreadExecutor in AbstractJournalStrorageManager use thread from global server thread pool.


---

[GitHub] activemq-artemis pull request #1899: ARTEMIS-1700 Fixed deadlock in paging s...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---

[GitHub] activemq-artemis pull request #1899: ARTEMIS-1700 Fixed deadlock in paging s...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1899#discussion_r170695023
  
    --- Diff: artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ArtemisExecutor.java ---
    @@ -50,6 +50,16 @@ default int shutdownNow(Consumer<? super Runnable> onPendingTask) {
           return 0;
        }
     
    +   default boolean flush(long timeout, TimeUnit unit) {
    +      CountDownLatch latch = new CountDownLatch(1);
    +      execute(latch::countDown);
    --- End diff --
    
    This won’t be used at all.  It’s just the default implementation for tests.  OrderedExecutor has an implementation. 


---

[GitHub] activemq-artemis issue #1899: ARTEMIS-1700 Fixed deadlock in paging state

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1899
  
    it's ready to be merged! testsuite pass!


---

[GitHub] activemq-artemis issue #1899: ARTEMIS-1700 Fixed deadlock in paging state

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1899
  
    @shoukunhuai please let me know if you still see any issues...
    
    Testsuites have improved after this commit.


---

[GitHub] activemq-artemis pull request #1899: ARTEMIS-1700 Fixed deadlock in paging s...

Posted by franz1981 <gi...@git.apache.org>.
Github user franz1981 commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1899#discussion_r170691220
  
    --- Diff: artemis-commons/src/main/java/org/apache/activemq/artemis/utils/actors/ArtemisExecutor.java ---
    @@ -50,6 +50,16 @@ default int shutdownNow(Consumer<? super Runnable> onPendingTask) {
           return 0;
        }
     
    +   default boolean flush(long timeout, TimeUnit unit) {
    +      CountDownLatch latch = new CountDownLatch(1);
    +      execute(latch::countDown);
    --- End diff --
    
    if the latch is submitted from within the same thread that is executing the tasks, waiting won't be necessary, because it cannot be triggered


---

[GitHub] activemq-artemis issue #1899: ARTEMIS-1700 Fixed deadlock in paging state

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1899
  
    You're right.. Man!!! you're good! :)
    
    I will send another PR!


---

[GitHub] activemq-artemis issue #1899: ARTEMIS-1700 Fixed deadlock in paging state

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1899
  
    @shoukunhuai see #1904


---

[GitHub] activemq-artemis issue #1899: ARTEMIS-1700 Fixed deadlock in paging state

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on the issue:

    https://github.com/apache/activemq-artemis/pull/1899
  
    Please wait my ack before merging this.. I'm running the whole testsuite!
    
    open for discussion only now



---