You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "hickey-ai (via GitHub)" <gi...@apache.org> on 2026/10/16 06:22:18 UTC

[PR] [Dubbo-16510] Handle partial reads and skips in StreamUtils [dubbo]

hickey-ai opened a new pull request, #16511:
URL: https://github.com/apache/dubbo/pull/16511

   ## What is the purpose of the change?
   
   Addresses #16510.
   
   `StreamUtils.limitedInputStream` treats `available()` as the total length, advances its position by the requested byte count rather than the delegate's actual progress, and reports EOF for a zero-length read at the limit. A legal short read/skip can therefore exhaust the limit early or report bytes that were never read. `skipUnusedStream` also stops after a partial skip.
   
   - Keep the requested limit independently of currently available bytes; cap `available()` to both the delegate estimate and remaining limit.
   - Account for the actual return values of single-byte reads, bulk reads, and skips. Preserve zero-length-read and EOF behavior and do not consume beyond the limit.
   - Complete short skips of the **initially available** cleanup budget, using a one-byte fallback when `skip()` makes no progress. Do not wait for future bytes or read an unbounded network stream to EOF.
   
   **Scope clarification for #16510:** `available() == 0` does not establish EOF, but this PR intentionally keeps cleanup restricted to bytes already available. A future-data draining change would alter its blocking semantics and is not proposed. The `limitedInputStream` read path still reads up to the requested limit even when its initial `available()` is zero.
   
   ## Validation
   
   Added nine focused regression/control cases in the existing `StreamUtilsTest`. Before the implementation change: 15 tests, 6 assertion failures, 0 errors/skips. After: all 15 pass.
   
   Executed on Windows 11 / OpenJDK 21 / Maven 3.6.3, against current `3.3` source:
   
   ```text
   mvn -B -pl dubbo-common -am -Dtest=StreamUtilsTest -Dsurefire.failIfNoSpecifiedTests=false test
   mvn -B -pl dubbo-remoting/dubbo-remoting-api -am -Dtest=org.apache.dubbo.common.io.*Test,ExchangeCodecTest,ChannelBufferInputStreamTest -Dsurefire.failIfNoSpecifiedTests=false test
   ```
   
   The broader run produced 7 Surefire suites: **85 tests, 82 passed, 3 pre-existing skips in ExchangeCodecTest, 0 failures/errors**. Formatting checks in the Maven test lifecycle and `git diff --check` passed. This is scoped module/caller regression verification, not the full repository suite or a production network test. Upstream GitHub Actions remain to be verified.
   
   ## Checklist
   
   - [x] Reference the reported issue and explain the blocking-semantics boundary.
   - [x] Add regression tests that fail before the fix and pass afterward.
   - [x] Run the affected I/O and exchange-codec regression tests locally.
   - [x] Check formatting and whitespace.
   - [ ] Upstream GitHub Actions completed successfully.
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] [Dubbo-16510] Handle partial reads and skips in StreamUtils [dubbo]

Posted by "hickey-ai (via GitHub)" <gi...@apache.org>.
hickey-ai commented on PR #16511:
URL: https://github.com/apache/dubbo/pull/16511#issuecomment-6229565823

   Noted, I will add unit tests to improve the patch coverage
   
   
   
   ---Original---
   From: "Codecov Comments ***@***.***&gt;
   Date: Fri, Oct 16, 2026 14:51 PM
   To: ***@***.***&gt;;
   Cc: ***@***.******@***.***&gt;;
   Subject: Re: [apache/dubbo] [Dubbo-16510] Handle partial reads and skips in StreamUtils (PR #16511)
   
   
   codecov-commenter left a comment (apache/dubbo#16511)
    
   Codecov Report
    
   ❌ Patch coverage is 16.00000% with 21 lines in your changes missing coverage. Please review.
    ✅ Project coverage is 32.18%. Comparing base (ae809de) to head (1ec22a7).
       Files with missing lines Patch % Lines 
       ...n/java/org/apache/dubbo/common/io/StreamUtils.java 16.00% 20 Missing and 1 partial ⚠️  
       
   ❗  There is a different number of reports uploaded between BASE (ae809de) and HEAD (1ec22a7). Click for more details.
    HEAD has 12 uploads less than BASE    Flag BASE (ae809de) HEAD (1ec22a7) 
       unit-tests-java8 2 0 
     unit-tests-java25 2 0 
     unit-tests-java17 2 0 
     unit-tests-java11 2 0 
     unit-tests-java21 2 0 
     integration-tests-java21 1 0 
     integration-tests-java8 1 0 
        Additional details and impacted files @@              Coverage Diff              @@ ##                3.3   #16511       +/-   ## ============================================= - Coverage     60.92%   32.18%   -28.74%      - Complexity       15    10226    +10211      =============================================   Files          1953     1952        -1        Lines         89278    89262       -16        Branches      13476    13394       -82      ============================================= - Hits          54390    28728    -25662      - Misses        29313    56309    +26996      + Partials       5575     4225     -1350     
       Flag Coverage Δ  
       integration-tests-java21 ?  
     integration-tests-java8 ?  
     samples-tests-java21 32.13% <16.00%&gt; (+0.02%) ⬆️ 
     samples-tests-java8 29.81% <16.00%&gt; (+0.01%) ⬆️ 
     unit-tests-java11 ?  
     unit-tests-java17 ?  
     unit-tests-java21 ?  
     unit-tests-java25 ?  
     unit-tests-java8 ?  
      
   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.
      
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today! 
   You are receiving this because you authored the thread.Message ID: ***@***.***&gt;


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] [Dubbo-16510] Handle partial reads and skips in StreamUtils [dubbo]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #16511:
URL: https://github.com/apache/dubbo/pull/16511#issuecomment-6209846739

   ## [Codecov](https://app.codecov.io/gh/apache/dubbo/pull/16511?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `16.00000%` with `21 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 32.18%. Comparing base ([`ae809de`](https://app.codecov.io/gh/apache/dubbo/commit/ae809de2fc81b408194240965eb20bf27e6971df?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`1ec22a7`](https://app.codecov.io/gh/apache/dubbo/commit/1ec22a7fbed5997578a20b13b8d60ea088995497?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/dubbo/pull/16511?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...n/java/org/apache/dubbo/common/io/StreamUtils.java](https://app.codecov.io/gh/apache/dubbo/pull/16511?src=pr&el=tree&filepath=dubbo-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fdubbo%2Fcommon%2Fio%2FStreamUtils.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZHViYm8tY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9kdWJiby9jb21tb24vaW8vU3RyZWFtVXRpbHMuamF2YQ==) | 16.00% | [20 Missing and 1 partial :warning: ](https://app.codecov.io/gh/apache/dubbo/pull/16511?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   > :exclamation:  There is a different number of reports uploaded between BASE (ae809de) and HEAD (1ec22a7). Click for more details.
   > 
   > <details><summary>HEAD has 12 uploads less than BASE</summary>
   >
   >| Flag | BASE (ae809de) | HEAD (1ec22a7) |
   >|------|------|------|
   >|unit-tests-java8|2|0|
   >|unit-tests-java25|2|0|
   >|unit-tests-java17|2|0|
   >|unit-tests-java11|2|0|
   >|unit-tests-java21|2|0|
   >|integration-tests-java21|1|0|
   >|integration-tests-java8|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##                3.3   #16511       +/-   ##
   =============================================
   - Coverage     60.92%   32.18%   -28.74%     
   - Complexity       15    10226    +10211     
   =============================================
     Files          1953     1952        -1     
     Lines         89278    89262       -16     
     Branches      13476    13394       -82     
   =============================================
   - Hits          54390    28728    -25662     
   - Misses        29313    56309    +26996     
   + Partials       5575     4225     -1350     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [integration-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [integration-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [samples-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `32.13% <16.00%> (+0.02%)` | :arrow_up: |
   | [samples-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `29.81% <16.00%> (+0.01%)` | :arrow_up: |
   | [unit-tests-java11](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java17](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java21](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java25](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unit-tests-java8](https://app.codecov.io/gh/apache/dubbo/pull/16511/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/dubbo/pull/16511?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] [Dubbo-16510] Handle partial reads and skips in StreamUtils [dubbo]

Posted by "hickey-ai (via GitHub)" <gi...@apache.org>.
hickey-ai commented on PR #16511:
URL: https://github.com/apache/dubbo/pull/16511#issuecomment-6234481554

   Added three boundary regressions in `885824a` covering exhausted bulk reads/skips preserving following source bytes, bulk-read argument validation at the limit, and cleanup reaching EOF before its initial available-byte estimate. This follow-up changes only tests; cleanup remains bounded to the initially available byte budget.
   
   Local validation on Java 21: all 18 `StreamUtilsTest` cases pass. The affected I/O and codec run has 88 tests: 85 passed, 3 pre-existing `ExchangeCodecTest` skips, and no failures or errors.
   
   All 32 GitHub Actions checks for `885824a` now pass, including the Java 8/11/17/21/25 unit jobs. The updated Codecov report confirms that all modified and coverable lines are covered by tests.


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org