[zeromq-dev] Erlang Ports and zmq_poll

Serge Aleynikov serge at aleynikov.org
Sat Jul 24 19:39:11 CEST 2010


While applying Chris's patch based on github.com/sustrik/zeromq2 to 
erlzmq I noticed that zmq_term() call blocks the thread running Erlang 
VM.  I saw on this mailing list someone else sending a patch for this 
issue and that the patch was applied:
http://github.com/sustrik/zeromq2/commit/11891ddd5577321a351a1850d28478e97f4b9162

but it doesn't seem to solve this particular problem.

I haven't spent to much time to trace the issue in zmq code base beyond 
the fact that I see the execution point is spinning inside

zmq::ctx_t::~ctx_t () {
    ...
    while (!zombies.empty()) {
         dezombity();
    }
    ...
}

and I also see that while the value of ctx_t::terminated is true, inside 
dezombify() sockets in the zombies list have terminated value equal to 
false.

It seems to me that inside zmq::ctx_t::dezombify() the zomby's 
terminated flag should respect the value of ctx_t::terminated, and 
zmq::socket_base_t::dezombify() should return true in that case (which 
is currently ignored when calling process_commands(false, false) inside 
that function.

It looks like a bug to me, though I don't know implications of this 
change on other termination scenarios.  If the description above is not 
clear, I can submit a patch.

On 7/20/2010 11:48 PM, chris wrote:
> Matthew Metnetsky<met<at>  uberstats.com>  writes:
>> I was wondering if anyone has used zmq_poll() as the communication loop
>> for an Erlang port? If so, any pointers?
>
> http://github.com/saleyn/erlzmq/issues#issue/2
>
> I've attached a patch to that issue that updates the erlang bindings to work
> with Sustrik's master branch which provides for the ability to support polling
> in erlang.  The erlang bindings can not support zmq_poll[^1] directly, as an
> erlang driver can not make a blocking call.
>
> The patch *works*, but the implementation could use some loving, in particular
> the zmqdrv_ready_input() function is sub optimal.
>
> Beyond that, Sustrik's zeromq is not fully stable yet.  In my testing, I'm not
> confident in running any type of system using erlang and zeromq at this point.
> I don't see this flushing out for several more weeks at least - really dependent
> on Serge or Dhammika becoming interested in bringing the bindings up to snuff.
> I've done what I could to make it *work*, but at this point I am looking at
> other solutions for my needs as this combination of technology isn't going to
> become mature enough in my time frame.
>
> Out of curiosity, you said "Erlang Ports" in plural. What ones are you aware of?
>
> chris
>
> 1. http://thread.gmane.org/gmane.network.zeromq.devel/1627/
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev



More information about the zeromq-dev mailing list