Skip to content

fix(proxy): return UNRECOGNIZED_CLIENT_TYPE when client settings is null in receiveMessage - #11138

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

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

Conversation

@zjncs

@zjncs zjncs commented Sep 11, 2026

Copy link
Copy Markdown

Motivation

A gRPC client that calls ReceiveMessage before any settings were cached (or after its settings were cleaned up) made getClientSettings return null, and the following settings.getClientType() threw a NullPointerException which the catch block turned into an opaque INTERNAL_SERVER_ERROR response.

ClientActivity.heartbeat already guards this case with UNRECOGNIZED_CLIENT_TYPE.

Modifications

Apply the same guard in receiveMessage so the client gets a meaningful code.

Verification

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

ReceiveMessageActivityTest#testReceiveMessageWithoutClientSettings
java.lang.AssertionError: expected:<UNRECOGNIZED_CLIENT_TYPE> but was:<INTERNAL_SERVER_ERROR>
  ReceiveMessageActivityTest.testReceiveMessageWithoutClientSettings:447
(root cause: NullPointerException on "Settings.getClientType()" because "settings" is null)

Pass-after:

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

…ull in receiveMessage

A gRPC client that calls ReceiveMessage before any settings were cached
(or after its settings were cleaned up) made getClientSettings return
null, and the following settings.getClientType() threw a
NullPointerException which the catch block turned into an opaque
INTERNAL_SERVER_ERROR response.

ClientActivity.heartbeat already guards this case with
UNRECOGNIZED_CLIENT_TYPE; apply the same guard in receiveMessage so the
client gets a meaningful code.
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

Add null check for client settings in receiveMessage, returning UNRECOGNIZED_CLIENT_TYPE instead of NPE when settings are not found.

LGTM — proper error handling for missing client configuration.


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