[zeromq-dev] Mac OS X: test_shutdown_stress sometimes fails

Dhammika Pathirana dhammika at gmail.com
Fri Nov 19 18:12:56 CET 2010


On Fri, Nov 19, 2010 at 8:53 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> On 11/19/2010 05:33 PM, Dhammika Pathirana wrote:
>
>> I think it's unplugged and passed to another thread, and second thread
>> is deleting it.
>> We do have two instances where we delete engines in process_attach().
>
> Right. But do you understand how come that out_event is called when the
> engine is already unplugged?
>
> I can't find the codepath that would do that :(
>


Think it was in mac crash log,

>> 0  zmq::signaler_t::send()
>> 1  zmq::ctx_t::send_command()
>> 2  zmq::object_t::send_command()
>> 3  zmq::object_t::send_term_req()
>> 4  zmq::own_t::terminate()
>> 5  zmq::zmq_init_t::finalise_initialisation()
>> 6  zmq::zmq_init_t::read()
>> 7  zmq::encoder_t::message_ready()
>> 8  zmq::encoder_base_t<zmq::encoder_t>::get_data()
>> 9  zmq::zmq_engine_t::out_event()
>> 10  zmq::kqueue_t::loop()
>> 11  zmq::kqueue_t::worker_routine()
>> 12  zmq::thread_t::thread_routine()


engine:out_event() is triggering finalise_initialization(), there we
pass it to the
other thread and receiving thread deletes engine.
But in out_event() first thread again dereferences same engine object
after get_data(),


149 void zmq::zmq_engine_t::out_event ()
150 {
151     //  If write buffer is empty, try to read new data from the encoder.
152     if (!outsize) {
153
154         outpos = NULL;
155         encoder.get_data (&outpos, &outsize);
156
157         //  If there is no data to send, stop polling for output.
158         if (outsize == 0) {
159             reset_pollout (handle);
160             return;
161         }
162     }



Dhammika



More information about the zeromq-dev mailing list