You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Tim Armstrong (Code Review)" <ge...@cloudera.org> on 2017/06/13 19:00:11 UTC

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Tim Armstrong has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/7171

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................

IMPALA-5499: avoid ephemeral port conflicts

We should not select the same port twice, which could happen because
multiple ports were selected consecutively without actually binding to
any of the ports.

Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
---
M be/src/rpc/thrift-server-test.cc
M be/src/statestore/statestore-test.cc
M be/src/testutil/in-process-servers.cc
M be/src/util/network-util.cc
M be/src/util/network-util.h
5 files changed, 29 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/71/7171/1
-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Lars Volker (Code Review)" <ge...@cloudera.org>.
Lars Volker has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 2: Code-Review+1

(3 comments)

http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/statestore/statestore-test.cc
File be/src/statestore/statestore-test.cc:

Line 76:   int subscriber_port = FindUnusedEphemeralPort(&used_ports);
> Is this the right place for it? Seems more like a unit test for FindUnusedE
I agree that adding a unit test would be the best place to put this but is probably not worth it. I thought adding it here will serve as a smoke test of sorts in case that functionality ever breaks inside FindUnusedEphemeralPort(). I'm also ok with leaving it as it is.


http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.cc
File be/src/util/network-util.cc:

Line 197:     }
> Changed back to a for() loop, which achieves the same thing. I was thinking
Thanks. I think this way it is also more obvious that the loop will always terminate.


http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.h
File be/src/util/network-util.h:

Line 70: int FindUnusedEphemeralPort(std::vector<int>* used_ports);
> I hit a compile error that I couldn't get around. Unsure if it's a compiler
I agree, let's keep it as is then.


-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 3: Code-Review+2

carry +2

-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 3:

Build started: http://jenkins.impala.io:8080/job/gerrit-verify-dryrun/732/

-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


IMPALA-5499: avoid ephemeral port conflicts

We should not select the same port twice, which could happen because
multiple ports were selected consecutively without actually binding to
any of the ports.

Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Reviewed-on: http://gerrit.cloudera.org:8080/7171
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Tested-by: Impala Public Jenkins
---
M be/src/rpc/thrift-server-test.cc
M be/src/statestore/statestore-test.cc
M be/src/testutil/in-process-servers.cc
M be/src/util/network-util.cc
M be/src/util/network-util.h
5 files changed, 27 insertions(+), 17 deletions(-)

Approvals:
  Impala Public Jenkins: Verified
  Tim Armstrong: Looks good to me, approved



-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 4
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Lars Volker (Code Review)" <ge...@cloudera.org>.
Lars Volker has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 1:

(3 comments)

http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/statestore/statestore-test.cc
File be/src/statestore/statestore-test.cc:

Line 76:   int subscriber_port = FindUnusedEphemeralPort(&used_ports);
you could assert that used_ports.back() == subscriber_port here and elsewhere. Or more generally that it is contained in the list if you don't want to assume a particular order.


http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.cc
File be/src/util/network-util.cc:

Line 206:     ++tries;
Shouldn't this be above the continue, possibly at the start of the loop? Otherwise tries that end up picking a port in used_ports will not be counted correctly.


http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.h
File be/src/util/network-util.h:

Line 70: int FindUnusedEphemeralPort(std::vector<int>* used_ports);
You could make this default to nullptr.


-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 2:

(4 comments)

http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/statestore/statestore-test.cc
File be/src/statestore/statestore-test.cc:

Line 76:   int subscriber_port = FindUnusedEphemeralPort(&used_ports);
> you could assert that used_ports.back() == subscriber_port here and elsewhe
Is this the right place for it? Seems more like a unit test for FindUnusedEphemeralPort() than an invariant of this function. I can add a unit test for the function but unsure if it's worth it.


http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.cc
File be/src/util/network-util.cc:

Line 197:     }
> Should'nt we increment tries here?
Changed back to a for() loop, which achieves the same thing. I was thinking that it was a bit weird to fail randomly because we picked numbers that were already used, but I guess it's no different from failing because the port was in use for other reasons.


Line 206:   close(sockfd);
> Shouldn't this be above the continue, possibly at the start of the loop? Ot
Done


http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.h
File be/src/util/network-util.h:

Line 70: int FindUnusedEphemeralPort(std::vector<int>* used_ports);
> You could make this default to nullptr.
I hit a compile error that I couldn't get around. Unsure if it's a compiler bug or something else but my inclination is to not spend time digging into it.

   error: default argument given for parameter 1 of ‘int impala::FindUnusedEphemeralPort(std::vector<int>*)’ [-fpermissive]
 int FindUnusedEphemeralPort(std::vector<int>* used_ports = nullptr);


-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 3: Verified+1

-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Lars Volker (Code Review)" <ge...@cloudera.org>.
Lars Volker has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 2: Code-Review+2

On second thought I am confident to +2 this. Please check with Anuj whether he has any other comments.

-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
anujphadke has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 2: Code-Review+1

-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "Tim Armstrong (Code Review)" <ge...@cloudera.org>.
Tim Armstrong has uploaded a new patch set (#2).

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................

IMPALA-5499: avoid ephemeral port conflicts

We should not select the same port twice, which could happen because
multiple ports were selected consecutively without actually binding to
any of the ports.

Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
---
M be/src/rpc/thrift-server-test.cc
M be/src/statestore/statestore-test.cc
M be/src/testutil/in-process-servers.cc
M be/src/util/network-util.cc
M be/src/util/network-util.h
5 files changed, 27 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/71/7171/2
-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 2
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Lars Volker <lv...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>

[Impala-ASF-CR] IMPALA-5499: avoid ephemeral port conflicts

Posted by "anujphadke (Code Review)" <ge...@cloudera.org>.
anujphadke has posted comments on this change.

Change subject: IMPALA-5499: avoid ephemeral port conflicts
......................................................................


Patch Set 1:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/7171/1/be/src/util/network-util.cc
File be/src/util/network-util.cc:

Line 197:       continue;
Should'nt we increment tries here?


-- 
To view, visit http://gerrit.cloudera.org:8080/7171
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Id02c83e6f946a14b83f5e6561957d7ad81442835
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Tim Armstrong <ta...@cloudera.com>
Gerrit-Reviewer: Sailesh Mukil <sa...@cloudera.com>
Gerrit-Reviewer: anujphadke <ap...@cloudera.com>
Gerrit-HasComments: Yes