Skip to content

[ISSUE #10904] Guard malformed retry counters in proxy send path - #10916

Open
123123213weqw wants to merge 3 commits into
apache:developfrom
123123213weqw:wangyue/issue-10904-retry-counter-guard
Open

[ISSUE #10904] Guard malformed retry counters in proxy send path#10916
123123213weqw wants to merge 3 commits into
apache:developfrom
123123213weqw:wangyue/issue-10904-retry-counter-guard

Conversation

@123123213weqw

Copy link
Copy Markdown

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

  • ProducerProcessor: parse retry counters with Integer.parseInt on a trimmed value inside try/catch, falling back to 0 and logging a warning on malformed input
  • valid counters keep their previous behavior

How was this patch verified

  • Code review: mirrors the existing bornTimestamp fallback pattern
  • git diff --check clean

@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

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 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.

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 NumberFormatException is 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 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

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

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.

[studio][Bug] Malformed retry counters can abort Proxy message forwarding

2 participants