celluloid / celluloid-io

UNMAINTAINED: See celluloid/celluloid#779 - Evented sockets for Celluloid actors
https://celluloid.io
MIT License
879 stars 93 forks source link

Rubinius crashes with IO::EINPROGRESSWaitWritable when opening Celluloid::IO::TCPSocket #179

Open slact opened 7 years ago

slact commented 7 years ago

Running the following code:

require 'celluloid/current'
require 'celluloid/io'

class Wut
  include Celluloid::IO
  attr_accessor :sock
  def initialize(host, port)
    @sock = Celluloid::IO::TCPSocket.new(host, port)
  end
end

huh = Wut.new("127.0.0.1", 8082)

print huh.sock

produces an error:

I, [2016-08-19T15:06:02.905490 #25952]  INFO -- : Celluloid 0.17.3 is running in BACKPORTED mode. [ http://git.io/vJf3J ]
E, [2016-08-19T15:06:03.008879 #25952] ERROR -- : Actor crashed!
IO::EINPROGRESSWaitWritable: unknown error - Operation now in progress - connect(2)
        core/errno.rb:15:in `handle'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27:in `write_nonblock'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:41:in `wrap_write_nonblock'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27:in `write_nonblock'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/socket/socket.rb:307:in `connect_nonblock'
        /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:120:in `create_socket'
        /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:53:in `initialize'
        core/alpha.rb:93:in `new'
        /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/socket.rb:39:in `new'
        ./what.rb:8:in `initialize'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/calls.rb:28:in `dispatch'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/call/sync.rb:16:in `dispatch'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:50:in `dispatch'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:76:in `task'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/actor.rb:339:in `task'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task.rb:44:in `initialize'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task/fibered.rb:14:in `create'
        core/proc.rb:20:in `call'
E, [2016-08-19T15:06:03.009950 #25952] ERROR -- : CLEANUP CRASHED!
IO::EINPROGRESSWaitWritable: unknown error - Operation now in progress - connect(2)
        core/errno.rb:15:in `handle'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27:in `write_nonblock'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:41:in `wrap_write_nonblock'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27:in `write_nonblock'
        /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/socket/socket.rb:307:in `connect_nonblock'
        /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:120:in `create_socket'
        /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:53:in `initialize'
        core/alpha.rb:93:in `new'
        /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/socket.rb:39:in `new'
        ./what.rb:8:in `initialize'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/calls.rb:28:in `dispatch'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/call/sync.rb:16:in `dispatch'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:50:in `dispatch'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:76:in `task'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/actor.rb:339:in `task'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task.rb:44:in `initialize'
        /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task/fibered.rb:14:in `create'
        core/proc.rb:20:in `call'
        (celluloid):0:in `remote procedure call'
An exception occurred running ./what.rb

unknown error - Operation now in progress - connect(2) (IO::EINPROGRESSWaitWritable)

Backtrace:

                                                 Errno.handle at core/errno.rb:15
                  { } in RubySL::Socket::Error.write_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27
                    RubySL::Socket::Error.wrap_write_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:41
                         RubySL::Socket::Error.write_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27
                                      Socket#connect_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/socket/socket.rb:307
                       Celluloid::IO::TCPSocket#create_socket at /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:120
                          Celluloid::IO::TCPSocket#initialize at /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:53
                                                    Class#new at core/alpha.rb:93
                                    Celluloid::IO::Socket.new at /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/socket.rb:39
                                               Wut#initialize at what.rb:8
              Celluloid::Call(Celluloid::Call::Sync)#dispatch at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/calls.rb:28
                               Celluloid::Call::Sync#dispatch at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/call/sync.rb:16
                              { } in Celluloid::Cell.dispatch at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:50
                                  { } in Celluloid::Cell#task at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:76
                                 { } in Celluloid::Actor#task at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/actor.rb:339
  { } in Celluloid::Task(Celluloid::Task::Fibered)#initialize at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task.rb:44
                       { } in Celluloid::Task::Fibered#create at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task/fibered.rb:14
                                                    Proc#call at core/proc.rb:20

Caused by: Operation now in progress - connect(2) (Errno::EINPROGRESS)

                                                 Errno.handle at core/errno.rb:15
                  { } in RubySL::Socket::Error.write_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27
                    RubySL::Socket::Error.wrap_write_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:41
                         RubySL::Socket::Error.write_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/rubysl/socket/error.rb:27
                                      Socket#connect_nonblock at /usr/lib/rubinius/gems/gems/rubysl-socket-2.1.2/lib/socket/socket.rb:307
                       Celluloid::IO::TCPSocket#create_socket at /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:120
                          Celluloid::IO::TCPSocket#initialize at /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/tcp_socket.rb:53
                                                    Class#new at core/alpha.rb:93
                                    Celluloid::IO::Socket.new at /usr/lib/rubinius/gems/gems/celluloid-io-0.17.3/lib/celluloid/io/socket.rb:39
                                               Wut#initialize at what.rb:8
              Celluloid::Call(Celluloid::Call::Sync)#dispatch at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/calls.rb:28
                               Celluloid::Call::Sync#dispatch at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/call/sync.rb:16
                              { } in Celluloid::Cell.dispatch at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:50
                                  { } in Celluloid::Cell#task at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/cell.rb:76
                                 { } in Celluloid::Actor#task at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/actor.rb:339
  { } in Celluloid::Task(Celluloid::Task::Fibered)#initialize at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task.rb:44
                       { } in Celluloid::Task::Fibered#create at /usr/lib/rubinius/gems/gems/celluloid-0.17.3/lib/celluloid/task/fibered.rb:14
                                                    Proc#call at core/proc.rb:20

However, removing the include Celluloid::IO line results in correct functioning (but obviously disables Celluloid):

require 'celluloid/current'
require 'celluloid/io'

class Wut
  #include Celluloid::IO
  attr_accessor :sock
  def initialize(host, port)
    @sock = Celluloid::IO::TCPSocket.new(host, port)
  end
end

huh = Wut.new("127.0.0.1", 8082)

print huh.sock
#<Celluloid::IO::TCPSocket:0x830c>

rubinius 3.50 (2.3.1 8a6c33ad 2016-07-25 3.8.0) [x86_64-linux-gnu] celluloid-io-0.17.3