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

Martin Sustrik sustrik at 250bpm.com
Sun Nov 21 12:04:15 CET 2010


Dhammika,

> 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);

Ah! I think I finally got it. At this point the engine is already 
unplugged (unplugging happens inside of get_data call).

So something like this would solve the problem:

               if (!plugged)
                   return;

Right?

> 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     }

Martin



More information about the zeromq-dev mailing list