Skip to content

Conversation

@lhotari
Copy link
Member

@lhotari lhotari commented May 21, 2025

Motivation

There's a bug in BlobStoreBackedReadHandleImplV2.readAsync which can be reproduced with
the existing test BlobStoreManagedLedgerOffloaderStreamingTest#testReadAndWriteAcrossSegment.
The test is flaky and could result in a ConcurrentModificationException.

java.util.ConcurrentModificationException
        at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1095)
        at java.base/java.util.ArrayList$Itr.next(ArrayList.java:1049)
        at org.apache.bookkeeper.mledger.offload.jcloud.impl.BlobStoreManagedLedgerOffloaderStreamingTest.testReadAndWriteAcrossSegment(BlobStoreManagedLedgerOffloaderStreamingTest.java:326)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
        at org.testng.internal.invokers.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:47)
        at org.testng.internal.invokers.InvokeMethodRunnable.call(InvokeMethodRunnable.java:76)
        at org.testng.internal.invokers.InvokeMethodRunnable.call(InvokeMethodRunnable.java:11)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)

While investigating this, I noticed that this is a real bug in production code.

It looks like this only impacts "streaming offload" implementation, "PIP 76: Streaming Offload".
It's a bit confusing since it looks like PIP-76 was never fully completed. I don't see any calls to org.apache.bookkeeper.mledger.LedgerOffloader#streamingOffload method in production code. Similarly, there's no org.apache.bookkeeper.mledger.LedgerOffloader#readOffloaded method calls in production code.

Modifications

  • complete the future outside of the reading loop in BlobStoreBackedReadHandleImplV2.readAsync

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.23%. Comparing base (bbc6224) to head (74b75b4).
Report is 1114 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24331      +/-   ##
============================================
+ Coverage     73.57%   74.23%   +0.66%     
+ Complexity    32624    32204     -420     
============================================
  Files          1877     1866      -11     
  Lines        139502   145124    +5622     
  Branches      15299    16593    +1294     
============================================
+ Hits         102638   107738    +5100     
+ Misses        28908    28860      -48     
- Partials       7956     8526     +570     
Flag Coverage Δ
inttests 26.67% <ø> (+2.08%) ⬆️
systests 23.25% <ø> (-1.08%) ⬇️
unittests 73.74% <100.00%> (+0.89%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...d/jcloud/impl/BlobStoreBackedReadHandleImplV2.java 60.24% <100.00%> (-0.91%) ⬇️

... and 1083 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lhotari lhotari merged commit bdf6277 into apache:master May 22, 2025
62 of 64 checks passed
lhotari added a commit that referenced this pull request Jun 2, 2025
…bStoreBackedReadHandleImplV2.readAsync (#24331)

(cherry picked from commit bdf6277)
lhotari added a commit that referenced this pull request Jun 2, 2025
…bStoreBackedReadHandleImplV2.readAsync (#24331)

(cherry picked from commit bdf6277)
lhotari added a commit that referenced this pull request Jun 2, 2025
…bStoreBackedReadHandleImplV2.readAsync (#24331)

(cherry picked from commit bdf6277)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
(cherry picked from commit b23b451)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
(cherry picked from commit ecf6164)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
(cherry picked from commit b23b451)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
(cherry picked from commit b23b451)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 5, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
(cherry picked from commit ecf6164)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 5, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
(cherry picked from commit b23b451)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 10, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
(cherry picked from commit b23b451)
nodece pushed a commit to nodece/pulsar that referenced this pull request Jun 18, 2025
…bStoreBackedReadHandleImplV2.readAsync (apache#24331)

(cherry picked from commit bdf6277)
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants