Skip to content

[ISSUE #10225] Avoid waiting on expired receipt handle locks - #11503

Open
qianye1001 wants to merge 3 commits into
apache:developfrom
qianye1001:codex/receipt-handle-lock-lease
Open

qianye1001 wants to merge 3 commits into
apache:developfrom
qianye1001:codex/receipt-handle-lock-lease

Conversation

@qianye1001

@qianye1001 qianye1001 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Which Issue(s) This PR Fixes

Fixes #10225

Brief Description

An already expired receipt handle lock currently incurs a full semaphore wait before the caller checks expiration. Follow the approach in #10226: try acquiring without waiting, check expiration before the timed acquire, and retain the expiration check after a timed acquire fails.

Use lockExpiredTimeMsInHandleGroup (default: 4000 ms) for both takeover and stale unlock rejection. The renewal RPC defaults to a 2-second timeout. Using the same threshold for unlock prevents a previous holder from releasing the semaphore after takeover at the default 4 seconds while still within the former 6-second release window.

The zero-wait acquire uses the interruptible overload to preserve existing interruption behavior. Acquisition timestamps are recorded after the acquire attempt. The change is confined to ReceiptHandleGroup, its existing test class and ProxyConfig.

How Did You Test This Change?

Added regressions for interrupt handling, the 4000 ms default, a custom 8000 ms expiration threshold, immediate takeover after expiration, rejection of the old holder's unlock, and normal release by the new holder. The expiration test sets the existing timestamp directly instead of sleeping at the expiration boundary.

Passed 22 focused tests, with 0 failures, 0 errors and 0 skipped:

mvn -B -pl proxy -am -DskipITs -DfailIfNoTests=false \
  -Djacoco.skip=true -Dnet.bytebuddy.experimental=true \
  -Dtest=ReceiptHandleGroupTest,DefaultReceiptHandleManagerTest,ReceiptHandleProcessorTest \
  test

Checkstyle, SpotBugs and git diff --check passed. Local validation used JDK 21 and Maven 3.9.9; the two compatibility flags accommodate the repository's existing JaCoCo/Byte Buddy versions. No throughput benchmark was run.

@qianye1001
qianye1001 force-pushed the codex/receipt-handle-lock-lease branch from e69605e to 23d8956 Compare November 3, 2026 03:49
@qianye1001 qianye1001 changed the title [ISSUE #10225] Remove receipt handle lock recovery gaps with ownership tokens [ISSUE #10225] Avoid waiting on expired receipt handle locks Nov 3, 2026
@codecov-commenter

codecov-commenter commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.83%. Comparing base (592d59d) to head (f3748ab).

Files with missing lines Patch % Lines
...ache/rocketmq/proxy/common/ReceiptHandleGroup.java 90.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #11503      +/-   ##
=============================================
- Coverage      49.91%   49.83%   -0.09%     
+ Complexity     14442    14409      -33     
=============================================
  Files           1391     1391              
  Lines         103362   103375      +13     
  Branches       13519    13521       +2     
=============================================
- Hits           51598    51519      -79     
- Misses         45572    45643      +71     
- Partials        6192     6213      +21     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Throughput of in-flight message renewal degrades while some handle data locks have expired

2 participants