[zeromq-dev] race condition in pipe?
Martin Sustrik
sustrik at fastmq.com
Mon Apr 13 07:17:02 CEST 2009
Hi Dhammika,
> writer_terminated in pipe sends term_ack to other thread and proceeds
> to reset pointers.
> However, on receiving term_ack api_thread deletes the pipe in
> terminate_pipe_ack (in engine_base.hpp)
> I think its possible to have a race condition here, and
> writer_terminated to could actually endup writing to deallocated
> memory.
This is probably the most complex part of the code. I've uploaded some
sequence diagrams here:
http://www.zeromq.org/docs:shutdown
I believe that writer_terminated gets called before reader_terminated
(deallocation of the pipe) in all cases.
Still, if you've found a race condition, write down exact sequence of
steps that causes the problem. We can start looking for the solution then.
Martin
More information about the zeromq-dev
mailing list