iloveeyjafjalla opened a new issue, #11387:
URL: https://github.com/apache/rocketmq/issues/11387

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions) of this repository 
and believe that this is not a duplicate.
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   ### Runtime platform environment
   
   OS: any (proxy module, gRPC v2 producer path)
   
   ### RocketMQ version
   
   branch: develop
   Git commit id: 9ea2ccdc2b41445aee5e177e14e501d606f5a1ed (the files are 
unchanged on develop@b76420599)
   
   ### JDK Version
   
   Compiler: Temurin 1.8.0_504 (target 1.8, same as CI)
   
   ### Describe the Bug
   
   Setting `maxUserPropertySize` to the documented "no limit" value rejects 
every message that carries a tag, a key or a user property.
   
   `ProxyConfig` documents the option as:
   
   ```java
   /**
    * max user property size, 0 or negative number means no limit for proxy
    */
   private int maxUserPropertySize = 16 * 1024;
   ```
   
   and the other size limits in `SendMessageActivity` all honour that 
convention:
   
   ```java
   int max = ConfigurationManager.getProxyConfig().getMaxMessageSize();
   if (max <= 0) { return; }                      // message body
   int maxSize = ...getMaxMessageGroupSize(); if (maxSize <= 0) { return; }     
// message group
   long maxDelay = ...getMaxDelayTimeMills();  if (maxDelay <= 0) { return; }   
// delay time
   long maxTransactionRecoverySecond = ...;    if (maxTransactionRecoverySecond 
<= 0) { return; }
   ```
   
   but the user-property check has no such guard:
   
   ```java
   if (userPropertySize > config.getMaxUserPropertySize()) {
       throw new GrpcProxyException(Code.MESSAGE_PROPERTIES_TOO_LARGE, "the 
total size of user property is too large, max is " + ...);
   }
   ```
   
   `userPropertySize` counts the user properties, the tag and the keys, so it 
is greater than `0` for any message that uses them —
   and with `maxUserPropertySize = 0` (or negative, i.e. the documented "no 
limit") every such send fails with
   `MESSAGE_PROPERTIES_TOO_LARGE`. The documented way of disabling the limit 
therefore bricks those sends instead of lifting
   the check.
   
   ### Steps to Reproduce
   
   1. Set `maxUserPropertySize: 0` in `rmq-proxy.json` (documented meaning: no 
limit).
   2. Send a message with a tag or a user property through a gRPC client.
   3. The broker answers `MESSAGE_PROPERTIES_TOO_LARGE` ("the total size of 
user property is too large, max is 0").
   
   ### Expected behavior
   
   A non-positive `maxUserPropertySize` disables the check, exactly like the 
other size limits of the same activity.
   
   ### Actual behavior
   
   Every message that carries a tag, a key or a user property is rejected.
   
   ### Additional context
   
   Fix: run the comparison only when the configured limit is positive.
   


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

Reply via email to