Repository navigation
[ISSUE #10620] Fix NPE when recording RPC latency for local proxy requests - #10621
majialoong wants to merge 4 commits into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot
Summary
Fixes NPE in NettyRemotingAbstract.writeResponse when recording RPC latency for local proxy requests by initializing processTimer in LocalRemotingCommand.createRequestCommand().
Findings
- [Info]
LocalRemotingCommand.java:35—Stopwatch.createStarted()is the correct initialization, matching the pattern used byRemotingCommandafterNettyDecoderprocessing. Clean and minimal fix. - [Info]
LocalRemotingCommandTest.java— Good test coverage with two focused tests: one verifying timer initialization, another verifying the full latency recording flow throughwriteResponse. The use ofNopLongHistogramoverride andSimpleChannelstub is appropriate.
Suggestions
- Consider adding a brief comment in
LocalRemotingCommand.createRequestCommand()explaining why the timer is initialized here (i.e., local commands bypassNettyDecoder), to help future maintainers understand the context.
Verdict
✅ Approve — Correct fix for a real NPE bug. The change is minimal, well-targeted, and includes proper test coverage. No compatibility or performance concerns.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #10621 +/- ##
=============================================
+ Coverage 50.26% 51.02% +0.75%
- Complexity 14610 14920 +310
=============================================
Files 1391 1391
Lines 103488 103775 +287
Branches 13562 13614 +52
=============================================
+ Hits 52017 52947 +930
+ Misses 45227 44559 -668
- Partials 6244 6269 +25 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review by github-manager-bot (Follow-up)
Thanks for addressing the suggestion! The added comment in LocalRemotingCommand.createRequestCommand() clearly explains why the timer is initialized there.
Changes in a6016f94
- Added inline comment explaining that local requests bypass
NettyDecoder— exactly as suggested.
Verdict
✅ Looks good. No further concerns.
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Defensive fix with proper validation and test coverage. LGTM.
Automated review by github-manager-bot
… batchAckMessage command creation
|
Hi @RongtongJin @lizhimins @ShannonDing , could you please help review this PR when you have a moment? I ran into this NPE during some performance testing in local proxy mode, it triggers on every async response (send/pop), causing frequent NPE logs and missing RPC latency metrics. Even though local mode isn't commonly used, I think it's still worth fixing. Thanks! |
Which Issue(s) This PR Fixes
Brief Description
Initialize
processTimerforLocalRemotingCommandto prevent an NPE and ensure RPC latency metrics are recorded correctly.How Did You Test This Change?
Added unit tests to verify that the timer is initialized and RPC latency can be recorded successfully.