CCCLL opened a new issue, #16517:
URL: https://github.com/apache/dubbo/issues/16517

   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   `3.3` branch (ae809de2fc), OpenJDK 21, macOS. The setting was added in 
#15781 and has not been released yet.
   
   ### Steps to reproduce this issue
   
   `dubbo.protocol.triple.max-message-size` (added in #15781, also exposed as 
`TripleConfig#maxMessageSize`) is read in `LengthFieldStreamingDecoder`, `Gzip` 
and `Bzip2` with:
   
   ```java
   Configuration conf = 
ConfigurationUtils.getEnvConfiguration(ApplicationModel.defaultModel());
   ```
   
   `getEnvConfiguration` only looks at OS environment variables, so the limit 
is ignored when it is set in any other way.
   
   Triple provider and consumer in one JVM (direct URL, no registry), limit set 
to 1024 bytes, a request carrying a 4096-character string:
   
   | How the limit is set | Result |
   |---|---|
   | not set | succeeds |
   | environment variable `DUBBO_PROTOCOL_TRIPLE_MAX_MESSAGE_SIZE=1024` | 
rejected: `Message size 4130 exceeds limit 1024` |
   | `-Ddubbo.protocol.triple.max-message-size=1024` | succeeds, limit ignored |
   | `dubbo.protocol.triple.max-message-size=1024` in `dubbo.properties` | 
succeeds, limit ignored |
   | `dubbo.protocol.triple.max-message-size=1024` in Spring Boot 
`application.properties` | succeeds, limit ignored |
   | `TripleConfig#setMaxMessageSize(1024)` on the `ProtocolConfig` | succeeds, 
limit ignored |
   
   The same applies in the other direction: an application that needs messages 
above the 50 MB default can only raise the limit through an environment 
variable.
   
   ### What you expected to happen
   
   The limit should take effect when it is set as a system property, in 
`dubbo.properties` or in Spring Boot properties, like the other 
`dubbo.protocol.triple.*` keys that are read without a URL 
(`rest.json-framework` in `HttpJsonUtils`, `rest.disallowed-content-types` in 
`CodecUtils`, `verbose`, `rest.enabled` and `rest.openapi.enabled` in 
`TripleProtocol`). Those all use 
`ConfigurationUtils.getGlobalConfiguration(...)`.
   
   ### Anything else
   
   Switching the three places to `getGlobalConfiguration` covers system 
properties, environment variables, the config center, Spring Boot properties 
and `dubbo.properties`. It would not cover a limit set only programmatically 
through `TripleConfig#setMaxMessageSize`: the decoder and the decompressors are 
created without access to the protocol config, and the other keys listed above 
have the same limitation.
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [x] Yes I am willing to submit a pull request on my own!
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to