You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/03/14 18:14:00 UTC

[jira] [Work logged] (ARTEMIS-3591) PagingStoreImpl#checkMemory can run the provided task more than once

     [ https://issues.apache.org/jira/browse/ARTEMIS-3591?focusedWorklogId=741096&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-741096 ]

ASF GitHub Bot logged work on ARTEMIS-3591:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Mar/22 18:13
            Start Date: 14/Mar/22 18:13
    Worklog Time Spent: 10m 
      Work Description: gemmellr opened a new pull request #3985:
URL: https://github.com/apache/activemq-artemis/pull/3985


   Stop paging checkMemory task executing twice in some cases.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 741096)
    Remaining Estimate: 0h
            Time Spent: 10m

> PagingStoreImpl#checkMemory can run the provided task more than once
> --------------------------------------------------------------------
>
>                 Key: ARTEMIS-3591
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3591
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.19.0
>            Reporter: Robbie Gemmell
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> PagingStoreImpl#checkMemory takes a Runnable argument. It takes steps to ensure that the given Runnable is an org.apache.activemq.artemis.utils.runnables.AtomicRunnable, or wraps it as one, before adding it to the 'onMemoryFreedRunnables' queue for later execution in some cases.
> There is a case where it does this and adds it to the queue [[1]|https://github.com/apache/activemq-artemis/blob/f8472fd736eff21d21ca2ab0c5a4dd22f0f1d00e/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java#L708], but then checks the paging state again to guard against a race and can decide to just run the action immediately [[2]|https://github.com/apache/activemq-artemis/blob/f8472fd736eff21d21ca2ab0c5a4dd22f0f1d00e/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java#L716]. However it uses the bare action to run it immediately, not the potentially-wrapped version it added to the queue by this point. If the passed Runnable was not already an AtomicRunnable, as it seems many wont be, then this will mean the original action is likely to be run more than once, immediately at this point and then again via the AtomicRunnable added to the queue (the next time the queue is processed).
> It should use a reference to the same AtomicRunnable object it adds to the queue, ensuring the underlying task is either run immediately or later, and not both. It could additionally try to remove the entry from the queue after running it.
> [1] [https://github.com/apache/activemq-artemis/blob/f8472fd736eff21d21ca2ab0c5a4dd22f0f1d00e/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java#L708]
> [2] [https://github.com/apache/activemq-artemis/blob/f8472fd736eff21d21ca2ab0c5a4dd22f0f1d00e/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java#L716]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)