You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2019/07/08 11:13:24 UTC

[GitHub] [activemq-artemis] wy96f opened a new pull request #2743: ARTEMIS-2418 Race conditions between cursor movement and page writing

wy96f opened a new pull request #2743: ARTEMIS-2418 Race conditions between cursor movement and page writing
URL: https://github.com/apache/activemq-artemis/pull/2743
 
 
   The current code of CursorIterator::internalGetNext is a little complicated and not easy to follow logically.
   
   And there are two race conditions between cursor movement and page writing:
   
   1. Suppose the cursor's initial position is (p1,0) and page p1 is live with 0 msg. When we call internalGetNext(), the cursor moves to next page, i.e. position is (p2, 0) now. Meanwhile p1 is filled with message m1 and p2 is created with m2. Then we retrieve m2 from p2 rather than m1.
   
   2. Suppose the cursor's initial position is (p1, 1) and the page p1 is non live with 1 msg. When we call  internalGetNext(), the cursor moves to position(p2, 0) and get null page cache since p2 is not yet created. Then p2 is created with m1 and p3 is created with m2 which means current writing page no. is p3. After the while loop the cursor moves to position(p3, 0) and we retrieve m2 from p3 rather than m1.
   
   In both cases we would miss message m1 and subsequent page files won't be deleted unless the broker restarts.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services