ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:95515] [Ruby master Bug#16277] UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04
       [not found] <redmine.issue-16277.20191023202026@ruby-lang.org>
@ 2019-10-23 20:20 ` brad
  2019-10-24  1:49 ` [ruby-core:95522] " shyouhei
  2019-10-25 15:39 ` [ruby-core:95548] " Greg.mpls
  2 siblings, 0 replies; 3+ messages in thread
From: brad @ 2019-10-23 20:20 UTC (permalink / raw)
  To: ruby-core

Issue #16277 has been reported by bradland (Brad Landers).

----------------------------------------
Bug #16277: UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04
https://bugs.ruby-lang.org/issues/16277

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:95522] [Ruby master Bug#16277] UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04
       [not found] <redmine.issue-16277.20191023202026@ruby-lang.org>
  2019-10-23 20:20 ` [ruby-core:95515] [Ruby master Bug#16277] UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04 brad
@ 2019-10-24  1:49 ` shyouhei
  2019-10-25 15:39 ` [ruby-core:95548] " Greg.mpls
  2 siblings, 0 replies; 3+ messages in thread
From: shyouhei @ 2019-10-24  1:49 UTC (permalink / raw)
  To: 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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:95548] [Ruby master Bug#16277] UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04
       [not found] <redmine.issue-16277.20191023202026@ruby-lang.org>
  2019-10-23 20:20 ` [ruby-core:95515] [Ruby master Bug#16277] UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04 brad
  2019-10-24  1:49 ` [ruby-core:95522] " shyouhei
@ 2019-10-25 15:39 ` Greg.mpls
  2 siblings, 0 replies; 3+ messages in thread
From: Greg.mpls @ 2019-10-25 15:39 UTC (permalink / raw)
  To: ruby-core

Issue #16277 has been updated by MSP-Greg (Greg L).


Would something like the following yield an equivalent object?

```ruby
require 'socket'
sock = Socket.new :UNIX, :STREAM
sock.bind Addrinfo.unix('tmp.sock', :STREAM)
sock.listen 1024
puts sock.local_address.unix?
```

----------------------------------------
Bug #16277: UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04
https://bugs.ruby-lang.org/issues/16277#change-82324

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-25 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-16277.20191023202026@ruby-lang.org>
2019-10-23 20:20 ` [ruby-core:95515] [Ruby master Bug#16277] UNIXServer#listen fails with Errno::EADDRINUSE error under Windows 10 / WSL Ubuntu 18.04 brad
2019-10-24  1:49 ` [ruby-core:95522] " shyouhei
2019-10-25 15:39 ` [ruby-core:95548] " Greg.mpls

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).