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 continues to receive data even if its close method is called #61

abicky opened this Issue Oct 22, 2017 · 1 comment


None yet
2 participants

abicky commented Oct 22, 2017

I expect to stop receiving data after is called, but it continues to receive data. Is this behavior expected?

Here is a reproducible code:

require 'socket'
require ''

HOST = ''
PORT = 1234

class ServerConnection < Coolio::TCPSocket
  def on_read(data)
    puts "received: #{data}"

event_loop =
server =, PORT, ServerConnection)

server_thr = { }
sock =, PORT)

puts " version: #{Coolio::VERSION}"

puts 'send a message'
sock.send "message", 0
sleep 1

puts 'server stopped'
sleep 1

puts 'send a message'
sock.send "message", 0
sleep 1

puts 'done'


% docker run --rm -v $PWD/coolio_example.rb:/coolio_example.rb ruby:2.4.2 bash -c 'gem install && ruby /coolio_example.rb'
Building native extensions.  This could take a while...
Successfully installed
1 gem installed version: 1.5.1
send a message
received: message
server stopped
send a message
received: message

This comment has been minimized.


repeatedly commented Oct 24, 2017

You need to call Loop#stop before server.close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment