Skip to content

[ISSUE #10278] Add enableGrpcChannelReceiptHandleRenew switch to disable proxy periodic handle renewal for gRPC clients#10279

Draft
qianye1001 wants to merge 5 commits intoapache:developfrom
qianye1001:feature/proxy-disable-handle-renew
Draft

[ISSUE #10278] Add enableGrpcChannelReceiptHandleRenew switch to disable proxy periodic handle renewal for gRPC clients#10279
qianye1001 wants to merge 5 commits intoapache:developfrom
qianye1001:feature/proxy-disable-handle-renew

Conversation

@qianye1001
Copy link
Copy Markdown
Contributor

@qianye1001 qianye1001 commented Apr 28, 2026

Which Issue(s) This PR Fixes

Brief Description

This PR adds a new dynamic switch enableGrpcChannelReceiptHandleRenew in ProxyConfig to allow disabling the proxy's periodic receipt handle renewal mechanism specifically for gRPC (GrpcClientChannel) consumers.

Background: The current auto-renew approach uses a short invisible time (~60s) and periodically calls changeInvisibleTime to extend it. While this protects against client crashes, it has a critical flaw: if the proxy crashes, the client's original handle (issued with short invisible time) has already expired, and the renewed handle is lost in proxy memory. The client cannot ack through another proxy, causing unavoidable duplicate consumption.

Changes:

  1. ProxyConfig.enableGrpcChannelReceiptHandleRenew (default true): New boolean switch targeting only gRPC channels. When set to false:

    • The proxy uses the consumer group's consumeTimeoutMinute (from SubscriptionGroupConfig) as the invisible time during pop for gRPC clients, giving the client a long-lived handle.
    • The proxy skips periodic changeInvisibleTime renewal calls for GrpcClientChannel instances only.
    • Non-gRPC channels (e.g., Remoting) continue to renew normally.
    • Handle storage and client-disconnect cleanup (nack) are preserved.
  2. ReceiveMessageActivity: When enableGrpcChannelReceiptHandleRenew=false, resolves the invisible time from the group's consumeTimeoutMinute instead of the short defaultInvisibleTimeMills.

  3. DefaultReceiptHandleManager: When enableGrpcChannelReceiptHandleRenew=false, the scheduled task still detects client disconnects (and nacks), but skips the periodic renewal loop only for channels that are instanceof GrpcClientChannel.

How Did You Test This Change?

  1. Verified compilation passes (mvn compile -pl proxy -am).
  2. Verified no IDE errors in all modified files.
  3. Existing unit tests in DefaultReceiptHandleManagerTest and ReceiptHandleProcessorTest continue to pass (they test with default enableGrpcChannelReceiptHandleRenew=true).

…o disable proxy periodic handle renewal for gRPC clients

- Add enableGrpcChannelReceiptHandleRenew config in ProxyConfig (default true for backward compatibility)
- When disabled, use group's consumeTimeoutMinute as invisibleTime for gRPC clients instead of short defaultInvisibleTimeMills
- Skip periodic changeInvisibleTime renewal in DefaultReceiptHandleManager only for GrpcClientChannel when disabled
- Still save handles and monitor client connectivity for disconnect cleanup (nack)
@qianye1001 qianye1001 force-pushed the feature/proxy-disable-handle-renew branch from 00c9f8d to b6eb654 Compare April 28, 2026 07:02
@qianye1001 qianye1001 changed the title [ISSUE #10278] Add enableReceiptHandleRenew switch to disable proxy periodic handle renewal [ISSUE #10278] Add enableGrpcChannelReceiptHandleRenew switch to disable proxy periodic handle renewal for gRPC clients Apr 28, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 28, 2026

Codecov Report

❌ Patch coverage is 91.42857% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.90%. Comparing base (5ad6a3e) to head (b27eb26).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...proxy/grpc/v2/consumer/ReceiveMessageActivity.java 85.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop   #10279      +/-   ##
=============================================
- Coverage      49.03%   48.90%   -0.14%     
+ Complexity     13489    13456      -33     
=============================================
  Files           1375     1375              
  Lines         100448   100482      +34     
  Branches       12971    12977       +6     
=============================================
- Hits           49257    49140     -117     
- Misses         45213    45321     +108     
- Partials        5978     6021      +43     

☔ View full report in Codecov by Sentry.
📢 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.

@qianye1001 qianye1001 marked this pull request as draft April 29, 2026 02:44
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.

[Feature] Add enableGrpcChannelReceiptHandleRenew switch to disable proxy receipt handle periodic renewal for gRPC clients

2 participants