qianye1001 opened a new pull request, #11503:
URL: https://github.com/apache/rocketmq/pull/11503

   ### Which Issue(s) This PR Fixes
   
   Fixes #10225
   
   ### Brief Description
   
   Receipt handle locks currently reject release after twice the configured 
wait timeout but permit takeover only after three times that timeout. With the 
defaults, a renewal completing at 6.1 seconds leaves its handle locked until 
after 9 seconds, even though the operation has finished. Callers can then spend 
another full wait timeout before checking expiration.
   
   Replace the semaphore and timestamp-based release heuristic with ownership 
tokens and a monotonic lease. The new `lockLeaseTimeMsInHandleGroup` defaults 
to 4000 ms, allowing extra time beyond the renewal RPC's default 2000 ms 
timeout. `lockTimeoutMsInHandleGroup` continues to define the caller's wait 
budget.
   
   - A current owner can release at any time, including after lease expiry if 
no takeover has occurred. Normal request failures release immediately.
   - A caller can take over at lease expiry. Waiting callers recheck at the 
earlier of lease expiry and their remaining wait budget.
   - Completion and release verify the ownership token atomically, so late 
callbacks cannot release a newer operation or commit stale updates/removals.
   - Async operations use a private handle copy, preserving receipt identity 
and renewal counters until the current owner commits the result. This also 
prevents a late renewal callback from mutating the shared handle before 
ownership is checked.
   - Synchronous callback failures release ownership; interrupted acquisition 
preserves the interrupt flag.
   
   Renewal scheduling already uses a zero wait budget. The improvement 
addresses expired-lock recovery and contention in handle operations; this PR 
does not claim a measured throughput increase. Local ownership checks do not 
cancel an RPC already sent to the broker or resolve an unknown remote outcome.
   
   ### How Did You Test This Change?
   
   Based on develop `592d59d12db356f8c98332d9e355a89d92590db3`, with its pinned 
rocketmq-apis submodule initialized.
   
   Passed all 32 focused tests (0 failures, 0 errors, 0 skipped), including:
   - Exact 4-second takeover boundary and release both before and after expiry.
   - Concurrent takeover, stale/duplicate unlock, lease-expiry wakeup, 
wait-budget timeout and interruption.
   - Late successful, removal and exceptional completions after takeover.
   - Immediate release after ordinary request timeout and synchronous failure.
   - Existing renewal, handle removal and receipt processor tests.
   
   ```sh
   mvn -B -pl proxy -am -DskipITs -DfailIfNoTests=false \
     -Djacoco.skip=true -Dnet.bytebuddy.experimental=true \
     
-Dtest=ReceiptHandleGroupLockTest,ReceiptHandleGroupTest,DefaultReceiptHandleManagerTest,ReceiptHandleProcessorTest
 test
   ```
   
   Checkstyle, SpotBugs and `git diff --check` passed. Local validation used 
JDK 21 and Maven 3.9.9; the two test flags work around the existing JaCoCo/Byte 
Buddy versions on JDK 21. No dependency versions were changed. No end-to-end 
load benchmark was run.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

  • [PR] [ISSUE #10225] Remove rece... qianye1001 (via GitHub) via commits

Reply via email to