iloveeyjafjalla opened a new pull request, #11388:
URL: https://github.com/apache/rocketmq/pull/11388
### Which Issue(s) This PR Fixes
- Fixes #11387
### Brief Description
`maxUserPropertySize` is documented as "0 or negative number means no limit
for proxy", and the other size limits in
`SendMessageActivity` all skip their check for a non-positive value. The
user-property check did not:
```java
if (userPropertySize > config.getMaxUserPropertySize()) {
throw new GrpcProxyException(Code.MESSAGE_PROPERTIES_TOO_LARGE, ...);
}
```
Because `userPropertySize` counts the user properties, the tag and the keys,
configuring the documented "no limit" value
(`0` or negative) rejected every message that uses a tag, a key or a
property — the option became unusable exactly in the
mode it documents.
The change applies the comparison only when the configured limit is
positive, matching `maxMessageSize`,
`maxMessageGroupSize`, `maxDelayTimeMills` and
`maxTransactionRecoverySecond` in the same class.
### How Did You Test This Change?
New test `SendMessageActivityTest#testZeroMaxUserPropertySizeMeansNoLimit`:
with `maxUserPropertySize = 0`, a message carrying
a tag and a user property must be sent (status `OK`); the config is restored
in a `finally`.
Results on Temurin JDK 8 (same JDK as CI), base `9ea2ccdc2` plus this patch:
- before the fix: `AssertionError: a zero max user property size means no
limit, but the message was rejected:
GrpcProxyException: the total size of user property is too large, max is 0`
- after the fix: `SendMessageActivityTest` (gRPC) 12 tests +
`remoting.activity.SendMessageActivityTest` 1 test — 13 tests,
0 failures
- `mvn -B -ntp -pl proxy package` with checkstyle + spotbugs enabled: `BUILD
SUCCESS`, spotbugs `BugInstance size is 0`
This change was prepared with AI assistance (analysis, patch and test
drafting); the diff and every result above were
reproduced locally by running the module's tests against the base commit and
the patched tree.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]