Skip to content

[Bug] dubbo.protocol.triple.max-message-size is only read from OS environment variables #16517

Open

Description

@CCCLL

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

3.3 branch (ae809de), 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:

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?

  • Yes I am willing to submit a pull request on my own!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions