zeromq / rbzmq

Ruby binding for 0MQ

Home Page:http://www.zeromq.org/bindings:ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GC nuking context if not held in a variable

kballenegger opened this issue · comments

Doing the following:

sub = ZMQ::Context.new(1).socket(ZMQ::SUB)
sub.connect('tcp://127.0.0.1:13001')
sub.setsockopt(ZMQ::SUBSCRIBE, '')

Sometimes works, but sometimes will not work. It seems to have to do with the garbage collector trying to clear the context.

I think the gem should attempt to prevent the context from being released when there are sockets using it.