chaoyoung opened a new pull request, #16581:
URL: https://github.com/apache/dubbo/pull/16581
## What is the purpose of the change?
Allow a valid zero-length message body through the streaming decoder.
Uncompressed Triple/gRPC messages can have empty protobuf payloads, but
allocating `BufferedInputStream` with the payload length currently throws
`IllegalArgumentException: Buffer size <= 0` before the fragment listener is
invoked.
Allocate at least one byte of buffering while preserving the zero payload
limit and remaining byte count. The bounded stream immediately returns EOF for
an empty message without consuming the following frame.
Regression coverage deserializes real protobuf `StringValue` messages
through the fragment listener and verifies empty/nonempty/empty adjacency,
one-message demand, message lengths, per-frame flow-control byte accounting,
EOF, and splitting the five-byte empty frame header at every input boundary.
Fixes #16580
## Validation
Reproduced on `3.3` at `1cf125c421691ab2b3f1b82f0125be03eff338c9`, using
OpenJDK 25 on macOS. Tests were added and run before the production change: all
seven new invocations reproduced `IllegalArgumentException: Buffer size <= 0`;
the two existing test invocations passed. After the fix, all nine decoder test
invocations passed.
```sh
mvn -B -pl dubbo-remoting/dubbo-remoting-http12 -am test \
-Dtest=LengthFieldStreamingDecoderTest \
-Dsurefire.failIfNoSpecifiedTests=false \
-Dspotless.skip=true -Dcheckstyle.skip=true -Drat.skip=true
mvn -B -pl dubbo-remoting/dubbo-remoting-http12 -am test \
'-Dtest=org.apache.dubbo.remoting.http12.**' \
-Dsurefire.failIfNoSpecifiedTests=false \
-Dspotless.skip=true -Dcheckstyle.skip=true -Drat.skip=true
mvn -B -pl dubbo-remoting/dubbo-remoting-http12 spotless:check
git diff --check
```
The complete HTTP/1.2 module test package ran: 38 tests, zero
failures/errors, two skipped. The skips are the existing Linux-only
`XmlSafetyTest` methods on macOS. Spotless and whitespace checks passed. The
full repository suite and CI were not run. Existing
compiler/ByteBuddy/serialization warnings were emitted.
AI assistance was used to develop the change, tests, and this description.
## Checklist
- [x] Link the published GitHub issue.
- [x] Explain the behavior and the minimal fix.
- [x] Add regression tests and observe the original failure before fixing it.
- [x] Run the affected module tests and formatting checks.
- [ ] GitHub Actions pass (pending CI).
--
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]