On Thu, Oct 14, 2010 at 2:05 PM, Martin Sustrik <[email protected]> wrote:
> On 10/14/2010 01:01 PM, [email protected] wrote:
>>
>> Same as before:
>>
>> (gdb) run epgm://eth1\;231.192.0.1:9999 255 10000
>> Starting program: /tmp/workspaces/zeromq2/perf/.libs/lt-remote_thr
>> epgm://eth1\;231.192.0.1:9999 255 10000
>> [Thread debugging using libthread_db enabled]
>> [New Thread 0x7ffff681f710 (LWP 8991)]
>> pure virtual method called
>> terminate called without an active exception
>>
>> Program received signal SIGABRT, Aborted.
>> [Switching to Thread 0x7ffff681f710 (LWP 8991)]
>> 0x00007ffff6a5f595 in raise () from /lib/libc.so.6
>> (gdb) bt
>> #0  0x00007ffff6a5f595 in raise () from /lib/libc.so.6
>> #1  0x00007ffff6a60a16 in abort () from /lib/libc.so.6
>> #2  0x00007ffff72e0ded in __gnu_cxx::__verbose_terminate_handler() ()
>> from /usr/lib/libstdc++.so.6
>> #3  0x00007ffff72df006 in ?? () from /usr/lib/libstdc++.so.6
>> #4  0x00007ffff72df033 in std::terminate() () from /usr/lib/libstdc++.so.6
>> #5  0x00007ffff72df98f in __cxa_pure_virtual () from /usr/lib/libstdc++.so.6
>> #6  0x00007ffff7b84841 in zmq::poller_base_t::execute_timers
>> (this=0x602180) at poller_base.cpp:88
>> #7  0x00007ffff7b7a948 in zmq::epoll_t::loop (this=0x602180) at epoll.cpp:137
>> #8  0x00007ffff7b8c347 in zmq::thread_t::thread_routine
>> (arg_=0x6021e8) at thread.cpp:79
>> #9  0x00007ffff7532cb0 in start_thread () from /lib/libpthread.so.0
>> #10 0x00007ffff6afb9fd in clone () from /lib/libc.so.6
>> #11 0x0000000000000000 in ?? ()
> I have no idea how it can happen after the patch is applied. Do you have
> a simple test program that reproduces the problem?

pgm_sender_t::unplug() cancels timers only if the corresponding
has_rx_timer or has_tx_timer flags have been set. So what may happen
is that even after unplug() there may still be timers registered at
poller_base_t.  And since pgm_sender_t::terminate() calls "delete
this" after unplug(), behaviour is undefined if
pgm_sender_t::timer_event(int token) is invoked again. (Here it seems
that the pure virtual base class methods are invoked instead. Could as
well be a segmentation fault I guess.). Likely this happens because in
void zmq::pgm_sender_t::out_event() rx_timer_id is reset. I think it
should be tx_timer_id instead, or?

-Toralf
From 5a0b404b60525fe7644fde8f29468fa9ecfc938b Mon Sep 17 00:00:00 2001
From: Toralf Wittner <[email protected]>
Date: Fri, 15 Oct 2010 16:37:33 +0200
Subject: [PATCH] Cancel tx_timer_id.

---
 src/pgm_sender.cpp |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/pgm_sender.cpp b/src/pgm_sender.cpp
index 55a8d4e..957de6d 100644
--- a/src/pgm_sender.cpp
+++ b/src/pgm_sender.cpp
@@ -174,9 +174,9 @@ void zmq::pgm_sender_t::out_event ()
         put_uint16 (out_buffer, offset == -1 ? 0xffff : (uint16_t) offset);
     }
 
-    if (has_rx_timer) {
-        cancel_timer (rx_timer_id);
-        has_rx_timer = false;
+    if (has_tx_timer) {
+        cancel_timer (tx_timer_id);
+        has_tx_timer = false;
     }
 
     //  Send the data.
-- 
1.7.3.1

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to