You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/03/15 15:09:31 UTC

[GitHub] [bookkeeper] lhotari commented on pull request #3110: PendingReadOp: Fix ledgerEntryImpl reuse problem

lhotari commented on pull request #3110:
URL: https://github.com/apache/bookkeeper/pull/3110#issuecomment-1068099040


   Thanks for the explanation @hangc0276 . I now understood how the race condition happens in `org.apache.bookkeeper.client.PendingReadOp#readEntryComplete` method and it answers my question.
   
   To prevent the problem I think that the current code needs revisiting. Why did @congbobo184 make this change: 7a1504ff8ee6140b4f63a9a6d0c1cd3485cf5887 ?
   I would assume that the close method would have to be as Congbo originally wrote
   ```java
           public void close() {
               if (complete.compareAndSet(false, true)) {
                   entryImpl.close();
               }
           }
   ```
   
   instead of the current version
   ```java
           public void close() {
               complete.set(true);
               entryImpl.close();
           }
   ```


-- 
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: issues-unsubscribe@bookkeeper.apache.org

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