[ISSUE #10904] Guard malformed retry counters in proxy send path - #10916
[ISSUE #10904] Guard malformed retry counters in proxy send path#10916123123213weqw wants to merge 3 commits into
Conversation
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR adds defensive parsing for reconsumeTimes and maxReconsumeTimes in ProducerProcessor. The original code used Integer.valueOf() which throws an unhandled NumberFormatException on malformed input. The fix wraps parsing in try-catch with a fallback to 0 and a warning log.
The change from Integer.valueOf() to Integer.parseInt() with .trim() is also a minor improvement.
LGTM. Good defensive fix.
Note: This PR also includes changes from #10914 and #10915. See the series overlap comment on those PRs.
Automated review by github-manager-bot
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Review Summary
This PR adds defensive parsing for retry counters in ProducerProcessor to handle malformed values gracefully.
Findings
- [Warning] ProducerProcessor.java — The try-catch for
NumberFormatExceptionis good defensive programming, but consider logging the malformed value for debugging purposes. - [Info] Using
trim()before parsing is a good practice to handle whitespace in header values.
Overall
Good defensive fix to prevent crashes from malformed retry counter headers.
Automated review by RockteMQ-AI
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
Adds defensive parsing for reconsumeTimes and maxReconsumeTimes in the proxy send path. Malformed values are caught, logged, and default to 0 instead of crashing the request.
Good defensive coding. LGTM.
Automated review by github-manager-bot
What is the purpose of the change
Fix #10904.
ProducerProcessor.buildSendMessageRequestHeader parsed retry-message counters with Integer.valueOf, so a malformed PROPERTY_RECONSUME_TIME or PROPERTY_MAX_RECONSUME_TIMES value threw NumberFormatException and aborted the Proxy send/retry path. The method already tolerated a malformed born timestamp by falling back to the current time; the retry counters now get the same defensive treatment.
Brief changelog
How was this patch verified
git diff --checkclean