-
Notifications
You must be signed in to change notification settings - Fork 12k
Description
Before Creating the Enhancement Request
- I have confirmed that this should be classified as an enhancement rather than a bug/feature.
Summary
A potential NPE (Null Pointer Exception) issue exists in the transaction metrics recording logic in SendMessageProcessor.java when isAsyncSendEnable is configured to false.
Motivation
Problem Details:
Location: broker/src/main/java/org/apache/rocketmq/broker/processor/SendMessageProcessor.java line 359
Root Cause: In synchronous send mode (isAsyncSendEnable = false), the transaction metrics recording condition check is incomplete
Specific Issue: When sendTransactionPrepareMessage is false, the code still attempts to access transaction-related metrics, potentially causing NPE
Reproduction Steps:
Configure isAsyncSendEnable = false
Send non-transactional messages
Observe logs for potential NPE occurrences
Expected Behavior:
Transaction metrics should only be recorded when processing transaction prepare messages, avoiding access to transaction-related services in non-transaction scenarios.
Impact Scope:
Message processing in synchronous send mode
Accuracy of transaction metrics statistics
System stability
Describe the Solution You'd Like
Fix NPE when isAsyncSendEnable is false in transaction metrics recording
Describe Alternatives You've Considered
No
Additional Context
No