You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by GitBox <gi...@apache.org> on 2023/01/10 14:53:45 UTC

[GitHub] [rocketmq] RagingSpud opened a new pull request, #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

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

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   fix #5740
   
   ## Brief changelog
   According to RFC 1122, { 127, any } are reserved for internal host loopback address.So `isInternalIP` function return true when ip is between 127.0.0.0~127.255.255.255.
   And now it prefers LAN ip to localhost(internal host loopback address).
   ## Verifying this change
   
   XXXX
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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


[GitHub] [rocketmq] ShadowySpirits commented on a diff in pull request #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

Posted by GitBox <gi...@apache.org>.
ShadowySpirits commented on code in PR #5856:
URL: https://github.com/apache/rocketmq/pull/5856#discussion_r1065930787


##########
common/src/main/java/org/apache/rocketmq/common/UtilAll.java:
##########
@@ -604,7 +606,7 @@ public static byte[] getIP() {
                             if (ipCheck(ipByte)) {
                                 if (!isInternalIP(ipByte)) {
                                     return ipByte;
-                                } else if (internalIP == null) {
+                                } else if (internalIP == null || internalIP[0] == (byte) 127) {

Review Comment:
   This judgment changes the behavior of the getIP function. If we only have lo interface, getIP will throw RuntimeException.



-- 
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


[GitHub] [rocketmq] RagingSpud commented on a diff in pull request #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

Posted by GitBox <gi...@apache.org>.
RagingSpud commented on code in PR #5856:
URL: https://github.com/apache/rocketmq/pull/5856#discussion_r1066024203


##########
common/src/main/java/org/apache/rocketmq/common/UtilAll.java:
##########
@@ -604,7 +606,7 @@ public static byte[] getIP() {
                             if (ipCheck(ipByte)) {
                                 if (!isInternalIP(ipByte)) {
                                     return ipByte;
-                                } else if (internalIP == null) {
+                                } else if (internalIP == null || internalIP[0] == (byte) 127) {

Review Comment:
   If we only have lo interface,`internalIP == null || internalIP[0] == (byte) 127)` will be true,so it will set `internalIP` to localhost and return.
   If we have lo and LAN ip,when it find the LAN ip,`internalIP == null || internalIP[0] == (byte) 127)` also will be true, so it will override the value of `internalIP`.
   Am I missing something?



-- 
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


[GitHub] [rocketmq] codecov-commenter commented on pull request #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #5856:
URL: https://github.com/apache/rocketmq/pull/5856#issuecomment-1379786746

   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#5856](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c246e09) into [develop](https://codecov.io/gh/apache/rocketmq/commit/5894332918e7158d6ff4cc35b126a1b82a1f6b0c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5894332) will **decrease** coverage by `0.00%`.
   > The diff coverage is `56.52%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #5856      +/-   ##
   =============================================
   - Coverage      42.48%   42.47%   -0.01%     
   - Complexity      8248     8251       +3     
   =============================================
     Files           1060     1060              
     Lines          73473    73488      +15     
     Branches        9616     9619       +3     
   =============================================
     Hits           31215    31215              
   - Misses         38334    38341       +7     
   - Partials        3924     3932       +8     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ocketmq/broker/processor/PeekMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1BlZWtNZXNzYWdlUHJvY2Vzc29yLmphdmE=) | `3.22% <0.00%> (ø)` | |
   | [...he/rocketmq/broker/processor/PopReviveService.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1BvcFJldml2ZVNlcnZpY2UuamF2YQ==) | `40.97% <0.00%> (+1.34%)` | :arrow_up: |
   | [...org/apache/rocketmq/store/DefaultMessageStore.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL0RlZmF1bHRNZXNzYWdlU3RvcmUuamF2YQ==) | `52.91% <ø> (ø)` | |
   | [...a/org/apache/rocketmq/store/stats/BrokerStats.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL3N0YXRzL0Jyb2tlclN0YXRzLmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...pache/rocketmq/store/stats/BrokerStatsManager.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL3N0YXRzL0Jyb2tlclN0YXRzTWFuYWdlci5qYXZh) | `50.74% <61.53%> (+0.43%)` | :arrow_up: |
   | [.../main/java/org/apache/rocketmq/common/UtilAll.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vVXRpbEFsbC5qYXZh) | `36.09% <66.66%> (-0.44%)` | :arrow_down: |
   | [...ker/processor/DefaultPullMessageResultHandler.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL0RlZmF1bHRQdWxsTWVzc2FnZVJlc3VsdEhhbmRsZXIuamF2YQ==) | `38.46% <100.00%> (ø)` | |
   | [...rocketmq/broker/processor/PopMessageProcessor.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcHJvY2Vzc29yL1BvcE1lc3NhZ2VQcm9jZXNzb3IuamF2YQ==) | `37.04% <100.00%> (+0.45%)` | :arrow_up: |
   | [.../transaction/queue/TransactionalMessageBridge.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvdHJhbnNhY3Rpb24vcXVldWUvVHJhbnNhY3Rpb25hbE1lc3NhZ2VCcmlkZ2UuamF2YQ==) | `69.51% <100.00%> (ø)` | |
   | [...rg/apache/rocketmq/common/stats/StatsSnapshot.java](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNTbmFwc2hvdC5qYXZh) | `84.61% <0.00%> (-15.39%)` | :arrow_down: |
   | ... and [25 more](https://codecov.io/gh/apache/rocketmq/pull/5856?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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


[GitHub] [rocketmq] ShadowySpirits commented on a diff in pull request #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

Posted by GitBox <gi...@apache.org>.
ShadowySpirits commented on code in PR #5856:
URL: https://github.com/apache/rocketmq/pull/5856#discussion_r1066524365


##########
common/src/main/java/org/apache/rocketmq/common/UtilAll.java:
##########
@@ -604,7 +606,7 @@ public static byte[] getIP() {
                             if (ipCheck(ipByte)) {
                                 if (!isInternalIP(ipByte)) {
                                     return ipByte;
-                                } else if (internalIP == null) {
+                                } else if (internalIP == null || internalIP[0] == (byte) 127) {

Review Comment:
   You are right. Please ignore this review.



-- 
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


[GitHub] [rocketmq] hzh0425 commented on pull request #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

Posted by GitBox <gi...@apache.org>.
hzh0425 commented on PR #5856:
URL: https://github.com/apache/rocketmq/pull/5856#issuecomment-1380187520

   Welcome @RagingSpud 


-- 
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


[GitHub] [rocketmq] hzh0425 merged pull request #5856: [ISSUE #5740] Fix util.getIP sometimes choose localhost over LAN ip.

Posted by GitBox <gi...@apache.org>.
hzh0425 merged PR #5856:
URL: https://github.com/apache/rocketmq/pull/5856


-- 
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