Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let the kernel select an empty port #59

Merged
merged 1 commit into from
Apr 24, 2017
Merged

Conversation

i110
Copy link
Contributor

@i110 i110 commented Apr 22, 2017

To mitigate race condition, stop using rand for selecting unused port and let the kernel do it with calling bind with port 0 (in perl, passing undef for LocalPort argument).
Currently I'm testing this change on h2o, and it seems to greatly improve the problem at least in Linux and OSX.

@kazuho
Copy link
Collaborator

kazuho commented Apr 22, 2017

Thank you for the PR.

My understanding is that this has been tested on Travis CI and has shown improvement.

@tokuhirom How about merging this and release a new release version? In the rare chance that the change shows a regression on some environment, we can release once that makes this change an option.

@tokuhirom
Copy link
Owner

LGTM. I'll release it :)

@tokuhirom tokuhirom merged commit ee11dac into tokuhirom:master Apr 24, 2017
tokuhirom added a commit that referenced this pull request Apr 24, 2017
Changelog diff is:

diff --git Changes Changes
index 3c2b8ec..b690972 100644
--- Changes
+++ Changes
@@ -2,6 +2,11 @@ Revision history for Perl module Test::TCP

 {{$NEXT}}

+2.18 2017-04-24T06:00:25Z
+    - let the kernel select an empty port #59
+      #59
+      (i110)
+
 2.17 2016-08-18T14:42:56Z
     - check_port can take 'host' argument(#55)
     - Fix test on Windows issue(#55)
tokuhirom added a commit that referenced this pull request May 11, 2017
Changelog diff is:

diff --git Changes Changes
index b690972..942a8f8 100644
--- Changes
+++ Changes
@@ -2,6 +2,24 @@ Revision history for Perl module Test::TCP

 {{$NEXT}}

+2.19 2017-05-11T13:02:47Z
+
+    commit aac1b06
+    Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
+    Date:   Thu May 11 18:40:13 2017 +0900
+
+        don't run command when the port is empty
+
+        Test::TCP do hack on Windows for checking port used.
+
+        0f4510d8
+
+        But this way always return 0 with succeeded with empty port. This is not
+        expected behavior. So this change fix to call check_port if the port is
+        not defined.
+
+        fixes #60
+
 2.18 2017-04-24T06:00:25Z
     - let the kernel select an empty port #59
       #59
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 17, 2017
2.19 2017-05-11T13:02:47Z

    commit aac1b06c1e3b0d73ca964794bab0c444d454ebcc
    Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
    Date:   Thu May 11 18:40:13 2017 +0900

        don't run command when the port is empty

        Test::TCP do hack on Windows for checking port used.

        tokuhirom/Test-TCP@0f4510d8

        But this way always return 0 with succeeded with empty port. This is not
        expected behavior. So this change fix to call check_port if the port is
        not defined.

        fixes #60

2.18 2017-04-24T06:00:25Z
    - let the kernel select an empty port #59
      tokuhirom/Test-TCP#59
      (i110)
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.

3 participants