[zeromq-dev] zbeacon deadlock
Pieter Hintjens
ph at imatix.com
Wed Jan 29 19:58:26 CET 2014
Nice catch. I've reproduced and fixed the error.
https://github.com/hintjens/czmq/commit/dc7b95b5f673ca42c63850d337b46146de0da8d6
On Tue, Jan 28, 2014 at 1:40 AM, Max Drechsler
<mdrechsler at rst-automation.de> wrote:
> I recently found a deadlock when using czmq's zbeacon_t.
> Code to reproduce:
>
> int main()
> {
> zbeacon_t* beacon = zbeacon_new( 2000 );
> assert( beacon );
> zbeacon_publish( beacon, (byte*)"Hello", 6 );
> zbeacon_subscribe( beacon, 0, 0 );
> while (!zctx_interrupted)
> {
> zmsg_t* msg = zmsg_recv( zbeacon_socket(beacon) );
> zmsg_destroy( &msg );
> }
>
> // Do some long term cleanups..
> sleep(1);
> zbeacon_destroy( &beacon );
> }
>
> Once SIGINT or SIGTERM are sent to the process, the zbeacons agent task
> exits the processing loop, so that the final destroy can't send TERMINATE to
> the agent. So the application gets stuck in zbeacon_destroy.
> My suggestion is to not test for zctx_interrupted in the s_agent_task
> function, so that the user can control the cleanup process.
>
> Kind Regards
> Max Drechsler
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
More information about the zeromq-dev
mailing list