You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Aias00 (via GitHub)" <gi...@apache.org> on 2026/07/29 08:07:22 UTC

[PR] [ISSUE #10690] Tolerate malformed SimpleChannel address ports [rocketmq]

Aias00 opened a new pull request, #10691:
URL: https://github.com/apache/rocketmq/pull/10691

   ### Which Issue(s) This PR Fixes
   
   Fixes #10690
   
   ### Brief Description
   
   `SimpleChannel.parseSocketAddress` already returns `null` for blank addresses and strings that do not match `host:port`, but it directly parsed the port when two segments were present. A malformed value such as `127.0.0.1:not-a-port` could make `remoteAddress()` or `localAddress()` throw `NumberFormatException`.
   
   This PR makes malformed port values follow the same invalid-address behavior by returning `null`, with a diagnostic warning. Valid addresses keep the existing behavior.
   
   ### How Did You Test This Change?
   
   ```bash
   mvn -pl proxy -Dtest=SimpleChannelTest -DfailIfNoTests=false test
   ```
   
   Result: `BUILD SUCCESS`, `Tests run: 2, Failures: 0, Errors: 0, Skipped: 0`.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


Re: [PR] [ISSUE #10690] Tolerate malformed SimpleChannel address ports [rocketmq]

Posted by "fuyou001 (via GitHub)" <gi...@apache.org>.
fuyou001 commented on PR #10691:
URL: https://github.com/apache/rocketmq/pull/10691#issuecomment-5128557476

   [P1] The malformed-port handling is incomplete for out-of-range values.
   
   The new catch handles `NumberFormatException`, but values such as `127.0.0.1:-1` and `127.0.0.1:65536` parse successfully as integers and then cause the `InetSocketAddress` constructor to throw `IllegalArgumentException`. Consequently, `remoteAddress()` and `localAddress()` can still throw for malformed ports instead of returning `null` as described by this PR.
   
   Please validate the parsed port explicitly as `0..65535` before constructing the address (preferable for clear semantics), or otherwise handle the constructor exception as invalid input.
   
   Please add assertions for `-1`, `65536`, a value larger than `Integer.MAX_VALUE`, an empty port, and whitespace, covering both `remoteAddress()` and `localAddress()`. It would also be useful to exercise the callers in `LocalProxyRelayService`, `ChannelManager`, `ContextInitPipeline`, and `RemotingChannel` so that a `null` address and an asynchronously completed relay callback are consumed safely.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


Re: [PR] [ISSUE #10690] Tolerate malformed SimpleChannel address ports [rocketmq]

Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 commented on PR #10691:
URL: https://github.com/apache/rocketmq/pull/10691#issuecomment-5138129470

   Addressed the malformed-port range feedback in commit `8ca55cbf4`.
   
   Changes:
   - Validate parsed `SimpleChannel` ports explicitly as `0..65535` before constructing `InetSocketAddress`.
   - Keep malformed values returning `null` instead of allowing `IllegalArgumentException` to propagate.
   
   Regression coverage added for both `remoteAddress()` and `localAddress()`:
   - non-numeric port
   - `-1`
   - `65536`
   - overflow value larger than `Integer.MAX_VALUE`
   - empty port
   - whitespace port
   
   Caller coverage added for:
   - `ChannelManager` consuming invalid remote/local addresses safely
   - `LocalProxyRelayService` completing the async relay callback and passing a `SimpleChannelHandlerContext` whose channel returns `null` remote/local addresses safely
   
   Local verification with JDK 8:
   `JAVA_HOME=$(/usr/libexec/java_home -v 1.8) mvn -pl proxy -Dtest=SimpleChannelTest,LocalProxyRelayServiceTest -DfailIfNoTests=false test`
   
   Result: `Tests run: 5, Failures: 0, Errors: 0, Skipped: 0`; checkstyle and spotbugs passed in the same run.


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


Re: [PR] [ISSUE #10690] Tolerate malformed SimpleChannel address ports [rocketmq]

Posted by "Aias00 (via GitHub)" <gi...@apache.org>.
Aias00 commented on PR #10691:
URL: https://github.com/apache/rocketmq/pull/10691#issuecomment-5144305588

   Addressed the malformed-port caller coverage in `34196e4d3`.
   
   Changes:
   - `ProxyChannel` / `RemotingChannel` now consume null or unparseable socket addresses without throwing.
   - `ContextInitPipeline` now tolerates null/unparseable local addresses.
   - Added regression coverage for `RemotingChannel` and `ContextInitPipeline`, in addition to the existing `SimpleChannel`, `ChannelManager`, and `LocalProxyRelayService` coverage.
   
   Local verification passed:
   `mvn -pl proxy -Dtest=SimpleChannelTest,LocalProxyRelayServiceTest,RemotingChannelTest,ContextInitPipelineTest -DfailIfNoTests=false test`


-- 
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: commits-unsubscribe@rocketmq.apache.org

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


Re: [PR] [ISSUE #10690] Tolerate malformed SimpleChannel address ports [rocketmq]

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

   ## [Codecov](https://app.codecov.io/gh/apache/rocketmq/pull/10691?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 48.22%. Comparing base ([`00e45b8`](https://app.codecov.io/gh/apache/rocketmq/commit/00e45b8a6db23efbe756d0306f10716156cfd4dd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`1fd7fcc`](https://app.codecov.io/gh/apache/rocketmq/commit/1fd7fcc7acdbd9611e9bb4afca8ccbe79b7a77a4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop   #10691      +/-   ##
   =============================================
   - Coverage      48.31%   48.22%   -0.09%     
   + Complexity     13511    13480      -31     
   =============================================
     Files           1380     1380              
     Lines         101091   101094       +3     
     Branches       13101    13101              
   =============================================
   - Hits           48844    48755      -89     
   - Misses         46285    46357      +72     
   - Partials        5962     5982      +20     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/rocketmq/pull/10691?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.
   </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: commits-unsubscribe@rocketmq.apache.org

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


Re: [PR] [ISSUE #10690] Tolerate malformed SimpleChannel address ports [rocketmq]

Posted by "Aias00 (via GitHub) via commits" <co...@rocketmq.apache.org>.
Aias00 closed pull request #10691: [ISSUE #10690] Tolerate malformed SimpleChannel address ports
URL: https://github.com/apache/rocketmq/pull/10691


-- 
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: commits-unsubscribe@rocketmq.apache.org

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