Skip to content

[ISSUE #16399] Close late input after streaming decoder shutdown - #16400

Open
dong0713 wants to merge 2 commits into
apache:3.3from
dong0713:fix/default-streaming-decoder-leak
Open

[ISSUE #16399] Close late input after streaming decoder shutdown#16400
dong0713 wants to merge 2 commits into
apache:3.3from
dong0713:fix/default-streaming-decoder-leak

Conversation

@dong0713

@dong0713 dong0713 commented Jul 29, 2026

Copy link
Copy Markdown

What is the purpose of the change

Fixes #16399. Mirror the #16391 fix for both streaming decoder implementations: when decode() is called after the decoder has been shut down, the input stream is now closed to release the underlying pooled ByteBuf wrapped with releaseOnClose = true.

#16391 introduced an early-return guard in both decoders but did not close the input on that guard, so the ByteBuf leaked. This PR closes that gap in both implementations.

Brief changelog

1. DefaultStreamingDecoder (dubbo-remoting-http12)

2. FinalFragmentStreamingDecoder (dubbo-remoting-websocket)

  • Close input streams rejected after the decoder has been closed or is closing (closing || closed early-return branch) — the symmetric counterpart of the DefaultStreamingDecoder fix, in the websocket module.

Verifying this change

  • DefaultStreamingDecoderTest (http12): closed-path + exception propagation.
  • FinalFragmentStreamingDecoderTest (websocket, new test dir): closed-path + closing-path + exception propagation.
  • Spotless and module compilation checks passed.

@codecov-commenter

codecov-commenter commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.93%. Comparing base (3a30432) to head (aaf3de7).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16400      +/-   ##
============================================
+ Coverage     60.87%   60.93%   +0.05%     
  Complexity    11766    11766              
============================================
  Files          1953     1953              
  Lines         89273    89281       +8     
  Branches      13473    13473              
============================================
+ Hits          54346    54399      +53     
+ Misses        29333    29284      -49     
- Partials       5594     5598       +4     
Flag Coverage Δ
integration-tests-java21 32.13% <0.00%> (-0.02%) ⬇️
integration-tests-java8 32.21% <0.00%> (-0.01%) ⬇️
samples-tests-java21 32.20% <0.00%> (+<0.01%) ⬆️
samples-tests-java8 29.80% <0.00%> (+0.01%) ⬆️
unit-tests-java11 59.15% <100.00%> (+0.03%) ⬆️
unit-tests-java17 58.66% <100.00%> (+0.02%) ⬆️
unit-tests-java21 58.64% <100.00%> (+0.03%) ⬆️
unit-tests-java25 58.61% <100.00%> (+0.04%) ⬆️
unit-tests-java8 59.22% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dong0713
dong0713 force-pushed the fix/default-streaming-decoder-leak branch from 6dbb1cd to 434e777 Compare July 29, 2026 02:42

@LI123456mo LI123456mo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @zrlw

@zrlw

zrlw commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What about FinalFragmentStreamingDecoder?

@LI123456mo

Copy link
Copy Markdown
Contributor

What about FinalFragmentStreamingDecoder?

Ooops , didn't see that , @dong0713 , here is the path "org.apache.dubbo.remoting.websocket".

Mirror the DefaultStreamingDecoder fix for FinalFragmentStreamingDecoder:
when decode() is called after the decoder is closing or closed, the input
stream is now closed to release the underlying pooled ByteBuf wrapped with
releaseOnClose. Add regression tests covering the closing and closed paths.
@dong0713

Copy link
Copy Markdown
Author

FinalFragmentStreamingDecoder shares the same late-input path (closing || closed returning without closing the input). Fixed symmetrically and added regression tests covering both the closing and closed paths. Pushed.

@dong0713 dong0713 changed the title [ISSUE #16399] Close late input after DefaultStreamingDecoder shutdown [ISSUE #16399] Close late input after streaming decoder shutdown Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultStreamingDecoder ByteBuf leak when decode() is called after close

4 participants