Hi Dhammika,
> 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()     !-- session deletes
> the engine --!
> 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()
>
> In step 9, IO thread is calling engine_t::out_event() callback, and
> the engine must be valid for the duration of this call.
> But in step 5, session thread receives the engine and deletes it.
> Don't you think there's a valid race here?
>
> engine->unplug() does detach the engine, but it only takes effect on
> callback return.
>    
I am not sure. The stack trace looks ok. How come session deletes the 
engine from zmq_init_t::finalise_initialisation?

Also, unplug seems to call rm_fd, which in turn does kevent_delete -- 
thus new events should not happen on the connection's fd anymore.

The events that were returned prior to the unplugging are ignored due to 
code like:

             if (pe->fd == retired_fd)
                 continue;

(see kqueue.cpp:164)

Am I missing something?

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

Reply via email to