apache / apache/rocketmq

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

Open Beginner friendly
#10,225 0 comments 0 reactions 0 assignees View on GitHub
type/enhancement
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
2d 20h
Merged PRs (30d)
26

Description

### Before Creating the Enhancement Request

- [x] I have confirmed that this should be classified as an enhancement rather than a bug/feature.

### Summary

In ReceiptHandleGroup.HandleData.lock(long timeoutMs), the current implementation always blocks for the full timeoutMs (default 3 seconds) on semaphore.tryAcquire(timeoutMs, ...) before checking whether the lock has expired.

This means even when the lock holder has been stuck for well over the expiration threshold (9 seconds), the calling thread still wastes up to 3 seconds waiting on the semaphore before it discovers it can force-acquire via the expiration path.

This unnecessary blocking impacts proxy throughput in scenarios like message renewal and could lead to significant duplicate consumptions due to untimely renewal.

### Motivation

Optimize in-flight message renewal throughput in lock expired scenario.

### Describe the Solution You'd Like

Add a non-blocking tryAcquire() as the fast path, and check the expiration condition before falling through to the blocking tryAcquire(timeout, unit)

### Describe Alternatives You've Considered

/

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at ReceiptHandleGroup.HandleData.lock(long timeoutMs) and inspect how the semaphore and expiration condition are currently checked. Verify the lock-renewal path, then run the relevant existing tests for ReceiptHandleGroup or lock expiration; done means expired locks no longer wait through the full timeout before the expiration path can acquire them.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.