Skip to content

fix(proxy): fall back to max long polling timeout when gRPC deadline is absent - #11139

Open
zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/receive-message-null-deadline
Open

zjncs wants to merge 1 commit into
apache:developfrom
zjncs:fix/receive-message-null-deadline

Conversation

@zjncs

@zjncs zjncs commented Sep 11, 2026

Copy link
Copy Markdown

Motivation

ContextInitPipeline only records the remaining deadline time when the gRPC call actually carries a deadline. For a call without one — which gRPC allows — ctx.getRemainingMs() returned null and the unboxing in the polling-time computation threw a NullPointerException, which the catch block turned into an INTERNAL_SERVER_ERROR response.

Modifications

Treat an absent deadline as grpcClientConsumerMaxLongPollingTimeoutMillis remaining time, so polling time and the timeout passed to popMessage stay bounded by the configured maximum instead of crashing.

Verification

Fail-before (new test, run against the unpatched code):

ReceiveMessageActivityTest#testReceiveMessageWithoutDeadline
java.lang.AssertionError: expected:<MESSAGE_NOT_FOUND> but was:<INTERNAL_SERVER_ERROR>
  ReceiveMessageActivityTest.testReceiveMessageWithoutDeadline:456
(root cause: NullPointerException on "Long.longValue()" because "timeRemaining" is null)

Pass-after:

Tests run: 10, Failures: 0, Errors: 0, Skipped: 0 -- ReceiveMessageActivityTest

…is absent

ContextInitPipeline only records the remaining deadline time when the
gRPC call actually carries a deadline. For a call without one - which
gRPC allows - ctx.getRemainingMs() returned null and the unboxing in
the pollingTime computation threw a NullPointerException, which the
catch block turned into an INTERNAL_SERVER_ERROR response.

Treat an absent deadline as grpcClientConsumerMaxLongPollingTimeoutMillis
remaining time: pollingTime and the timeout passed to popMessage stay
bounded by the configured maximum instead of crashing.
Copilot AI lite review requested due to automatic review settings September 11, 2026 07:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Fall back to grpcClientConsumerMaxLongPollingTimeoutMillis when the gRPC deadline is absent (null remainingMs), instead of relying on auto-unboxing which would throw NPE.

LGTM — clean null safety fix.


Automated review by github-manager-bot

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.

3 participants