From 991f7e2c85919daef43c62175da046e0a085f8e3 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Wed, 9 Nov 2011 13:12:46 +0100 Subject: [PATCH 1/3] Set libzmq ABI version to 3 libzmq master (3.1) is not ABI compatible with libzmq 2.1.x or 3.0 (removed functionality), hence the ABI version needs to be set to 3. Signed-off-by: Martin Lucina --- configure.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index 86147eaa..9006f037 100644 --- a/configure.in +++ b/configure.in @@ -25,11 +25,13 @@ AC_SUBST(PACKAGE_VERSION) # # Changes: # -# ZeroMQ versions prior to 2.1.0 use 0.0.0 ("unstable") -# ZeroMQ version 2.1.0: 1:0:0 +# ZeroMQ versions prior to 2.1.0 use 0:0:0 (undefined) +# ZeroMQ versions 2.1.x: 1:0:0 (ABI version 1) +# ZeroMQ version 3.0: 2:0:0 (ABI version 2) +# ZeroMQ version 3.1: 3:0:0 (ABI version 3) # # libzmq -version-info current:revision:age -LTVER="1:0:0" +LTVER="3:0:0" AC_SUBST(LTVER) # Take a copy of original flags From 82d935309eede60777b59af9df7a50576916d01f Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Wed, 14 Dec 2011 00:00:32 +0100 Subject: [PATCH 2/3] Fix synchronous connect failure for ipc://, tcp:// (LIBZMQ-294) A synchronous connect() failure in ipc_connecter can result in Assertion failed: s == retired_fd (ipc_connecter.cpp:174), as reported in LIBZMQ-294. This patch fixes the bug, and also an identical problem in tcp_connecter which has not hit people since TCP connect() usually completes via the asynchronous code path (poll, out_event). Signed-off-by: Martin Lucina --- src/ipc_connecter.cpp | 1 + src/tcp_connecter.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/ipc_connecter.cpp b/src/ipc_connecter.cpp index dc0ee216..58dccf46 100644 --- a/src/ipc_connecter.cpp +++ b/src/ipc_connecter.cpp @@ -135,6 +135,7 @@ void zmq::ipc_connecter_t::start_connecting () } // Handle any other error condition by eventual reconnect. + close (); wait = true; add_reconnect_timer(); } diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp index 75079da5..042e82a7 100644 --- a/src/tcp_connecter.cpp +++ b/src/tcp_connecter.cpp @@ -146,6 +146,7 @@ void zmq::tcp_connecter_t::start_connecting () } // Handle any other error condition by eventual reconnect. + close (); wait = true; add_reconnect_timer(); } From c34a1443651ce5a6d8f7a88d0677ec85c81e1570 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Wed, 4 Jan 2012 11:48:41 +0100 Subject: [PATCH 3/3] Fix pgm_receiver.cpp: zmq_assert (pending_bytes == 0) (LIBZMQ-205) This patch fixes the problem described in LIBZMQ-205. The assertion itself is probably caused by previously queued POLLIN events arriving after POLLIN has been disabled on the socket. The following additional bugs have been fixed as part of debugging this problem: - pgm_receiver_t does not flush messages written to the session in all cases which can lead to a stalled reader. Add calls to session->flush () in the appropriate places. - ensure to restart polling when a pending message is flushed in activate_in (). Signed-off-by: Martin Lucina --- src/pgm_receiver.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/pgm_receiver.cpp b/src/pgm_receiver.cpp index 122d1109..99e882bd 100644 --- a/src/pgm_receiver.cpp +++ b/src/pgm_receiver.cpp @@ -117,8 +117,15 @@ void zmq::pgm_receiver_t::activate_in () // processed the whole buffer but failed to write // the last message into the pipe. if (pending_bytes == 0) { - if (mru_decoder != NULL) + if (mru_decoder != NULL) { mru_decoder->process_buffer (NULL, 0); + session->flush (); + } + + // Resume polling. + set_pollin (pipe_handle); + set_pollin (socket_handle); + return; } @@ -128,6 +135,7 @@ void zmq::pgm_receiver_t::activate_in () // Ask the decoder to process remaining data. size_t n = mru_decoder->process_buffer (pending_ptr, pending_bytes); pending_bytes -= n; + session->flush (); if (pending_bytes > 0) return; @@ -145,7 +153,8 @@ void zmq::pgm_receiver_t::in_event () unsigned char *data = NULL; const pgm_tsi_t *tsi = NULL; - zmq_assert (pending_bytes == 0); + if (pending_bytes > 0) + return; if (has_rx_timer) { cancel_timer (rx_timer_id);