Skip to content

[Bug] Fix NPE when recording RPC latency for local proxy requests #10620

Description

@majialoong

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Runtime platform environment

All

RocketMQ version

5.x

JDK Version

All

Describe the Bug

In Local Proxy mode, LocalRemotingCommand does not initialize processTimer because the request does not pass through NettyDecoder.

This causes a NullPointerException in the ChannelFutureListener of NettyRemotingAbstract.writeResponse when recording the RPC latency.

Steps to Reproduce

  1. Start RocketMQ Proxy in Local mode.
  2. Send a message through the gRPC endpoint.
  3. Inspect NettyRemotingAbstract.writeResponse when the response is written.
  4. Observe that request.getProcessTimer() is null.
Image

What Did You Expect to See?

The local request should have an initialized process timer, and the RPC latency metric should be recorded successfully.

What Did You See Instead?

A NullPointerException occurs when calling request.getProcessTimer().elapsed(...).

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions