Comments (6)
So basically, removing the "Blah" class above and letting Client and Server inherit directly from ZMQEntity works on both 0.13.0 and 0.14.0, unfortunately that's not a reasonable "fix" on the much larger project where I encountered this issue.
from celluloid-zmq.
I would imagine this to be a problem with the determination of the mailbox class.
Can you confirm if this is problem with IO
too?
If so, it is should be a core fix.
from celluloid-zmq.
Well I did a simple test on IO and that wouldn't work on either 0.13.0 or 0.14.0 - basically just hung there. Just by introducing an intermediate class before the actual final implementations. Perhaps I did something wrong there but here's the code for IO that I tried:
if ENV.key?('CELLULOID_14')
gem 'celluloid-io', '=0.14.0'
gem 'celluloid', '=0.14.0'
else
gem 'celluloid-io', '=0.13.0'
gem 'celluloid', '=0.13.0'
end
require 'celluloid/io'
class IOEntity
include Celluloid::IO
def initialize(host, port)
@host = host
@port = port
end
end
class Blah < IOEntity
def initialize(host,port)
super
end
end
class EchoClient < Blah
def initialize(host, port)
super
every(2) do
echo "Hello from client: #{Time.now}"
end
end
def socket
@socket ||= TCPSocket.new(@host, @port)
end
def echo(s)
socket.write(s)
puts socket.readpartial(4096)
end
end
class EchoServer < Blah
finalizer :finalize
def initialize(host, port)
super
puts "*** Starting echo server on #{host}:#{port}"
# Since we included Celluloid::IO, we're actually making a
# Celluloid::IO::TCPServer here
@server = TCPServer.new(@host, @port)
async.run
end
def finalize
@server.close if @server
end
def run
loop { async.handle_connection @server.accept }
end
def handle_connection(socket)
_, port, host = socket.peeraddr
puts "*** Received connection from #{host}:#{port}"
loop { socket.write socket.readpartial(4096) }
rescue EOFError
puts "*** #{host}:#{port} disconnected"
socket.close
end
end
supervisor = EchoServer.supervise("127.0.0.1", 1234)
trap("INT") { supervisor.terminate; exit }
client = EchoClient.new("127.0.0.1", 1234)
puts client.echo("Initial hello from client: #{Time.now}")
sleep
from celluloid-zmq.
No, I made a mistake. Had to also specify the Celluloid gem version. I edited above example code for Celluloid-IO and now it fails in the same way ZMQ does, eg. works on 0.13.0, fails on 0.14.0. Sounds reasonable that it has to do with the mailbox class determination.
from celluloid-zmq.
@halorgium Yes, it seems to be the determination of the mailbox class. Here's some output when checking what kind of class that is:
Inheriting directly from toplevel class:
[ john ~ ]$ CELLULOID_14=yes ruby celluloid_io_test.rb
0.14.0
*** Starting echo server on 127.0.0.1:1234
Celluloid::IO::Mailbox ## it's the "correct" celluloid evented mailbox as it should be
*** Received connection from 127.0.0.1:53928
Initial hello from client: 2013-05-13 17:57:44 +0200
Inheriting from a subclass of the toplevel class:
[ john ~ ]$ CELLULOID_14=yes ruby celluloid_io_test.rb
0.14.0
*** Starting echo server on 127.0.0.1:1234
Celluloid::Mailbox ## it's the "standard" celluloid mailbox when it shouldn't be
Didn't test on ZMQ but I assume the same thing happens. It's probably somewhere around here:
https://github.com/celluloid/celluloid/blob/v0.14.0/lib/celluloid.rb#L288
I'll be filing the issue with a link to here directly in the main Celluloid repo now.
from celluloid-zmq.
Closing in favor of celluloid issue.
from celluloid-zmq.
Related Issues (20)
- The libzmq version 2.0.7 is incompatible with ffi-rzmq HOT 3
- No License.txt HOT 1
- exclamation mark HOT 2
- PubSocket : writing to a specific topic HOT 2
- require of celluloid-io is no longer needed. HOT 1
- No specs? HOT 1
- Support jeromq, jrzmq? HOT 3
- How to handle closing sockets? HOT 8
- zmq_proxy / ZMQ::Poll in Actor HOT 9
- Authentication and Encryption HOT 6
- Internal reactor lock on high message pressure in router-dealer pair HOT 2
- release 0.17 HOT 15
- Multi-process example. HOT 1
- Assertion failed: check () (src/msg.cpp:248) HOT 7
- Port to rbczmq HOT 53
- Test suite broken HOT 1
- Function 'zlistx_head' not found HOT 3
- `rake spec` throw exceptions
- How thread safety is handle by Celluloid-ZMQ with ffi-rzmq HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from celluloid-zmq.