You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "merlimat (via GitHub)" <gi...@apache.org> on 2026/03/20 15:42:08 UTC

[PR] [fix][broker] Fix IllegalArgumentException in BucketDelayedDeliveryTracker.addMessage [pulsar]

merlimat opened a new pull request, #25371:
URL: https://github.com/apache/pulsar/pull/25371

   ## Flaky test failure
   
   ```
   java.lang.IllegalArgumentException
   	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:127)
   	at org.apache.pulsar.broker.delayed.bucket.BucketDelayedDeliveryTracker.addMessage(BucketDelayedDeliveryTracker.java:401)
   ```
   
   ## Summary
   
   - Fix `IllegalArgumentException` in `BucketDelayedDeliveryTracker.addMessage` when a ledger ID falls within the current mutable bucket range (`startLedgerId <= ledgerId < endLedgerId`).
   - The old code had a gap in its condition: it checked `ledgerId < startLedgerId` to route to `sharedBucketPriorityQueue`, then assumed the else branch always had `ledgerId >= endLedgerId` — but ledger IDs within `[startLedgerId, endLedgerId)` fell through and hit `checkArgument(ledgerId >= endLedgerId)` which throws.
   - Fix by inverting the condition: check the "fast path" first (`ledgerId >= endLedgerId && !existBucket` → add to mutable bucket), and route everything else to `sharedBucketPriorityQueue`. This removes the `checkArgument` that assumed monotonic ordering.
   - The class is annotated `@ThreadSafe` and all public methods are `synchronized`, so it should handle any concurrent call pattern gracefully.
   - Verified 100/100 passes with `invocationCount=100` on the thread safety test, plus all 24 `BucketDelayedDeliveryTrackerTest` pass.
   
   ## Documentation
   
   - [x] `doc-not-needed`
   (Your PR doesn't need any doc update)
   
   ## Matching PR in forked repository
   
   _No response_
   
   ### Tip
   
   Add the labels `ready-to-test` and `area/test` to trigger the CI.


-- 
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: commits-unsubscribe@pulsar.apache.org

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


Re: [PR] [fix][broker] Fix IllegalArgumentException in BucketDelayedDeliveryTracker.addMessage [pulsar]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #25371:
URL: https://github.com/apache/pulsar/pull/25371#issuecomment-4101168442

   ## [Codecov](https://app.codecov.io/gh/apache/pulsar/pull/25371?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 72.71%. Comparing base ([`a3ae705`](https://app.codecov.io/gh/apache/pulsar/commit/a3ae70545f3aef40e8f5cfcced907e6500b08894?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0b38ff2`](https://app.codecov.io/gh/apache/pulsar/commit/0b38ff2020cbe03e12cab38987120c53d1657373?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 2 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree graph](https://app.codecov.io/gh/apache/pulsar/pull/25371/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/pulsar/pull/25371?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #25371      +/-   ##
   ============================================
   + Coverage     72.52%   72.71%   +0.19%     
   + Complexity    34275     2458   -31817     
   ============================================
     Files          1927     1954      +27     
     Lines        154339   154791     +452     
     Branches      17683    17730      +47     
   ============================================
   + Hits         111935   112558     +623     
   + Misses        33389    33198     -191     
   - Partials       9015     9035      +20     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pulsar/pull/25371/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [inttests](https://app.codecov.io/gh/apache/pulsar/pull/25371/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `25.82% <0.00%> (-0.21%)` | :arrow_down: |
   | [systests](https://app.codecov.io/gh/apache/pulsar/pull/25371/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `22.43% <0.00%> (?)` | |
   | [unittests](https://app.codecov.io/gh/apache/pulsar/pull/25371/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `73.68% <100.00%> (-0.07%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/pulsar/pull/25371?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...r/delayed/bucket/BucketDelayedDeliveryTracker.java](https://app.codecov.io/gh/apache/pulsar/pull/25371?src=pr&el=tree&filepath=pulsar-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fpulsar%2Fbroker%2Fdelayed%2Fbucket%2FBucketDelayedDeliveryTracker.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9kZWxheWVkL2J1Y2tldC9CdWNrZXREZWxheWVkRGVsaXZlcnlUcmFja2VyLmphdmE=) | `83.29% <100.00%> (-0.04%)` | :arrow_down: |
   
   ... and [175 files with indirect coverage changes](https://app.codecov.io/gh/apache/pulsar/pull/25371/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@pulsar.apache.org

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


Re: [PR] [fix][broker] Fix IllegalArgumentException in BucketDelayedDeliveryTracker.addMessage [pulsar]

Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat merged PR #25371:
URL: https://github.com/apache/pulsar/pull/25371


-- 
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: commits-unsubscribe@pulsar.apache.org

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