From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id DBD851F4C0 for ; Thu, 24 Oct 2019 01:50:00 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 020EF120B61; Thu, 24 Oct 2019 10:49:51 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 1111C120B60 for ; Thu, 24 Oct 2019 10:49:48 +0900 (JST) Received: by filter0084p3iad2.sendgrid.net with SMTP id filter0084p3iad2-24335-5DB1033E-10 2019-10-24 01:49:50.192034879 +0000 UTC m=+184805.035001827 Received: from herokuapp.com (unknown [52.90.27.11]) by ismtpd0072p1mdw1.sendgrid.net (SG) with ESMTP id LApyamZZREW1T8444IPg0w for ; Thu, 24 Oct 2019 01:49:50.091 +0000 (UTC) Date: Thu, 24 Oct 2019 01:49:50 +0000 (UTC) From: shyouhei@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71114 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16277 X-Redmine-Issue-Author: bradland X-Redmine-Sender: shyouhei X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?jcfQDMoo=2FMGCmP3uu1SeyLQUxUPXq5PjHpHz3xSFn17cnX5BjcZ4BMdW1on8B4?= =?us-ascii?Q?h24LwredFwWCRbiDE28t0VkOi0v0J+i3QI4YX1i?= =?us-ascii?Q?uR=2Fcz8uWDK34BTdhgLKURXfp1kA=2FFfekrejzjAE?= =?us-ascii?Q?LW8c4M0bWx0BLyPTxTSmucztQjN5ji1KLttMLD8?= =?us-ascii?Q?6zRrHMXswnY+JCvGDMlJn=2FwVTijrVVPwGWw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95522 Subject: [ruby-core:95522] [Ruby master Bug#16277] UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04 X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16277 has been updated by shyouhei (Shyouhei Urabe). This is very nuanced. I'm not sure who is in charge of the exception. `UNIXServer.new`'s return value socket is already listened inside of the method. Calling `listen` again on a socket that is already listening, might or might not error depending on OS. That's why you see exceptions on WSL and not on Linux. The problem I see is why at the beginning you want to listen again a socket returned from `UNIXServer.new`. I guess you want to change (maybe increase) the backlog? Then there seems to be no way for `UNIXServer.new` to change backlog than listening again. Is it possible for a WSL-hosted application to dynamically change the backlog per-socket? If not (== there is no way but to specify enough backlog at the birth), I guess this is a misfeature of UNIXServer. ---------------------------------------- Bug #16277: UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04 https://bugs.ruby-lang.org/issues/16277#change-82295 * Author: bradland (Brad Landers) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux-gnu] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- When running the following script under Windows 10 / WSL Ubuntu 18.04, an Errno::EADDRINUSE error is thrown. Expected result is that the script would run and simply exit. ``` ruby #!/usr/bin/env ruby # This script establishes a UNIX server socket. # # Expected result: Script should run and immediately exit. # # Actual result: Script fails with Errno::EADDRINUSE error. # # Environment: Windows 10 Pro, WSL, Ubuntu 18.04.2, ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux-gnu] # # To reproduce: Create a tmp folder, copy this script there, and execute. require 'socket' path = File.expand_path('listen.sock') backlog = 5 s = UNIXServer.new(path) if backlog s.listen backlog else s.listen end File.delete(path) if File.exists?(path) ``` The bug was discoverd as part of Puma (gem) issue #1521: https://github.com/puma/puma/issues/1521. -- https://bugs.ruby-lang.org/