Hallo,

I am using proton 0.91 and I constantly experience crashes on process 
termination.
I use two messengers, one to read primary input queue and the other to send 
replies.
Primary messenger is used in non-blocking mode. On termination I do the 
following:

   if (_reply) {
      pn_messenger_stop(_reply);
      pn_messenger_free(_reply);
   }
   if (_primary) {
      pn_messenger_set_blocking(_primary, 1);
      pn_messenger_stop(_primary);
      pn_messenger_free(_primary);     /// <====
   }

When prmary messenger is freed the process almost always crashes. I have 
investigated
this using valgrind and I got the following:

==14853== Invalid read of size 8
==14853==    at 0x5368435: pn_object_reify (object.c:213)
==14853==    by 0x53685D6: pn_class_decref (object.c:92)
==14853==    by 0x537634F: pn_event_finalize_cast (event.c:190)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x53764F1: pn_collector_pop (event.c:167)
==14853==    by 0x5376547: pn_collector_release (event.c:34)
==14853==    by 0x5376568: pn_collector_free (event.c:87)
==14853==    by 0x5382539: pn_messenger_free (messenger.c:780)
==14853==    by 0x510AB39: kit::EventLoop::~EventLoop() (EventLoop.cc:84)
==14853==    by 0x5118DAB: kit::Application::~Application() (kit+.cc:172)
==14853==    by 0x416F42: plc::Driver::~Driver() (plc-driver.cc:127)
==14853==    by 0x40AE5E: CPLC::~CPLC() (cplc.cc:40)
==14853==    by 0x40B755: main (cplc.cc:215)
==14853==  Address 0xd79c8e0 is 0 bytes inside a block of size 408 free'd
==14853==    at 0x4C29577: free (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14853==    by 0x5368615: pn_class_decref (object.c:103)
==14853==    by 0x5373784: pn_connection_finalize (engine.c:463)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x537634F: pn_event_finalize_cast (event.c:190)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x53764F1: pn_collector_pop (event.c:167)
==14853==    by 0x5376547: pn_collector_release (event.c:34)
==14853==    by 0x5376568: pn_collector_free (event.c:87)
==14853==    by 0x5382539: pn_messenger_free (messenger.c:780)
==14853==    by 0x510AB39: kit::EventLoop::~EventLoop() (EventLoop.cc:84)
==14853==    by 0x5118DAB: kit::Application::~Application() (kit+.cc:172)
==14853==    by 0x416F42: plc::Driver::~Driver() (plc-driver.cc:127)
==14853==    by 0x40AE5E: CPLC::~CPLC() (cplc.cc:40)
==14853==    by 0x40B755: main (cplc.cc:215)
==14853==
==14853== Invalid read of size 4
==14853==    at 0x5368470: pn_object_decref (object.c:236)
==14853==    by 0x53685DF: pn_class_decref (object.c:93)
==14853==    by 0x537634F: pn_event_finalize_cast (event.c:190)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x53764F1: pn_collector_pop (event.c:167)
==14853==    by 0x5376547: pn_collector_release (event.c:34)
==14853==    by 0x5376568: pn_collector_free (event.c:87)
==14853==    by 0x5382539: pn_messenger_free (messenger.c:780)
==14853==    by 0x510AB39: kit::EventLoop::~EventLoop() (EventLoop.cc:84)
==14853==    by 0x5118DAB: kit::Application::~Application() (kit+.cc:172)
==14853==    by 0x416F42: plc::Driver::~Driver() (plc-driver.cc:127)
==14853==    by 0x40AE5E: CPLC::~CPLC() (cplc.cc:40)
==14853==    by 0x40B755: main (cplc.cc:215)
==14853==  Address 0xd79c8e8 is 8 bytes inside a block of size 408 free'd
==14853==    at 0x4C29577: free (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14853==    by 0x5368615: pn_class_decref (object.c:103)
==14853==    by 0x5373784: pn_connection_finalize (engine.c:463)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x537634F: pn_event_finalize_cast (event.c:190)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x53764F1: pn_collector_pop (event.c:167)
==14853==    by 0x5376547: pn_collector_release (event.c:34)
==14853==    by 0x5376568: pn_collector_free (event.c:87)
==14853==    by 0x5382539: pn_messenger_free (messenger.c:780)
==14853==    by 0x510AB39: kit::EventLoop::~EventLoop() (EventLoop.cc:84)
==14853==    by 0x5118DAB: kit::Application::~Application() (kit+.cc:172)
==14853==    by 0x416F42: plc::Driver::~Driver() (plc-driver.cc:127)
==14853==    by 0x40AE5E: CPLC::~CPLC() (cplc.cc:40)
==14853==    by 0x40B755: main (cplc.cc:215)
==14853==
==14853== Invalid read of size 4
==14853==    at 0x5368460: pn_object_refcount (object.c:229)
==14853==    by 0x53685E5: pn_class_decref (object.c:94)
==14853==    by 0x537634F: pn_event_finalize_cast (event.c:190)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x53764F1: pn_collector_pop (event.c:167)
==14853==    by 0x5376547: pn_collector_release (event.c:34)
==14853==    by 0x5376568: pn_collector_free (event.c:87)
==14853==    by 0x5382539: pn_messenger_free (messenger.c:780)
==14853==    by 0x510AB39: kit::EventLoop::~EventLoop() (EventLoop.cc:84)
==14853==    by 0x5118DAB: kit::Application::~Application() (kit+.cc:172)
==14853==    by 0x416F42: plc::Driver::~Driver() (plc-driver.cc:127)
==14853==    by 0x40AE5E: CPLC::~CPLC() (cplc.cc:40)
==14853==    by 0x40B755: main (cplc.cc:215)
==14853==  Address 0xd79c8e8 is 8 bytes inside a block of size 408 free'd
==14853==    at 0x4C29577: free (in 
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==14853==    by 0x5368615: pn_class_decref (object.c:103)
==14853==    by 0x5373784: pn_connection_finalize (engine.c:463)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x537634F: pn_event_finalize_cast (event.c:190)
==14853==    by 0x53685F7: pn_class_decref (object.c:97)
==14853==    by 0x53764F1: pn_collector_pop (event.c:167)
==14853==    by 0x5376547: pn_collector_release (event.c:34)
==14853==    by 0x5376568: pn_collector_free (event.c:87)
==14853==    by 0x5382539: pn_messenger_free (messenger.c:780)
==14853==    by 0x510AB39: kit::EventLoop::~EventLoop() (EventLoop.cc:84)
==14853==    by 0x5118DAB: kit::Application::~Application() (kit+.cc:172)
==14853==    by 0x416F42: plc::Driver::~Driver() (plc-driver.cc:127)
==14853==    by 0x40AE5E: CPLC::~CPLC() (cplc.cc:40)
==14853==    by 0x40B755: main (cplc.cc:215)

EventLoop.cc:84 is the line marked with "<====" in the code excerpt above.
How can I help to investigate it further?

best regards,
-- 
 \   / |                                   |
 (OvO) |  Mikhail Iwanow                   |
 (^^^) |                                   |
  \^/  |      E-mail:  iv...@logit-ag.de   |
  ^ ^  |                                   |

Reply via email to