Hi Martin,

On Tue, Jan 4, 2011 at 1:53 AM, Martin Sustrik <sust...@250bpm.com> wrote:
> Hi Dhammika,
>
>> It's actually in zmq.
>> Terminated pipe writer gets a "activate" command. But load balancer
>> doesn't decrement active pipe count in terminate() call.
>>
>>  55 void zmq::lb_t::terminate ()
>>  56 {
>>  57     zmq_assert (!terminating);
>>  58     terminating = true;
>>  59
>>  60     sink->register_term_acks (pipes.size ());
>>  61     for (pipes_t::size_type i = 0; i != pipes.size (); i++)
>>  62         pipes [i]->terminate ();
>>  63 }
>
> Hm. Termination is an async process. So, at this point termination of all
> the pipes is started, but it will take some time to finish. As the time
> progresses, individual pipes will unregister themselves from the
> load-balancer.
>


Yes, terminate() just initiates shutdown process.
But on "activate_writer" command pipe writer tries to move the pipe
back into active list, even when it's in terminating state.

301 void zmq::writer_t::process_activate_writer (uint64_t msgs_read_)
302 {
340     //  If the writer was non-active before, let's make it active
341     //  (available for writing messages to).
342     if (!active) {
343         active = true;
344         zmq_assert (sink);
345         sink->activated (this);
346     }
347 }

But load balancer hasn't removed the pipe from its active list, so
"active" index in following swap call is off.

 80 void zmq::lb_t::activated (writer_t *pipe_)
 81 {
 82     //  Move the pipe to the list of active pipes.
 83     pipes.swap (pipes.index (pipe_), active);
 84     active++;
 85 }


Dhammika
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to