Hello,


I am using proton cpp version 0.27.0.

We found a random failure in our code in proton sometime ago.

I was able to reproduce using simple code against a java broker. Please
find attached the code and the stack.

The frequency is lower with the simplified code but we are still
encountering the crash before reaching 60 000 repetitions.



Murex will be using Proton and we need to ensure we have no such failure
before using the code in production.



Can you please advise?

Do you need me to create a Jira issue?



Best regards,

Rabih
#0  0x0000000000000000 in ?? ()
#1  0x00007fbb25e2a200 in pn_class_decref (clazz=0x257a100, object=0x25888f0) 
at /proton-workspace/qpid-proton-0.27.0/c/src/core/object/object.c:91
#2  0x00007fbb25e333a6 in pn_connection_driver_destroy (d=0x258a628) at 
/proton-workspace/qpid-proton-0.27.0/c/src/core/connection_driver.c:93
#3  0x00007fbb26056704 in pconnection_final_free (pc=0x258a080) at 
/proton-workspace/qpid-proton-0.27.0/c/src/proactor/epoll.c:889
#4  0x00007fbb2605a03c in pconnection_done (p=Unhandled dwarf expression opcode 
0xf3) at /proton-workspace/qpid-proton-0.27.0/c/src/proactor/epoll.c:1044
#5  pn_proactor_done (p=Unhandled dwarf expression opcode 0xf3) at 
/proton-workspace/qpid-proton-0.27.0/c/src/proactor/epoll.c:2166
#6  0x00007fbb26dbfc42 in proton::container::impl::thread (this=0x2588100) at 
/proton-workspace/qpid-proton-0.27.0/cpp/src/proactor_container_impl.cpp:751
#7  0x00007fbb26dc0220 in proton::container::impl::run (this=0x2588100, 
threads=<value optimized out>) at 
/proton-workspace/qpid-proton-0.27.0/cpp/src/proactor_container_impl.cpp:788
#8  0x00000000004810ea in 
ContainerTest_rabih_Test::TestBody()::{lambda()#1}::operator()() const ()
#9  0x0000000000482e1c in void 
std::_Bind_simple<ContainerTest_rabih_Test::TestBody()::{lambda()#1} 
()()>::_M_invoke<>(std::_Index_tuple<>) ()
#10 0x0000000000482d61 in 
std::_Bind_simple<ContainerTest_rabih_Test::TestBody()::{lambda()#1} 
()()>::operator()() ()
#11 0x0000000000482cde in 
std::thread::_Impl<std::_Bind_simple<ContainerTest_rabih_Test::TestBody()::{lambda()#1}
 ()()> >::_M_run() ()
#12 0x00007fbb26b40470 in ?? () from /usr/lib64/libstdc++.so.6
#13 0x00007fbb27254851 in start_thread () from /lib64/libpthread.so.0
#14 0x00007fbb2634590d in clone () from /lib64/libc.so.6
#include <proton/connection.hpp>
#include <proton/container.hpp>
#include <proton/messaging_handler.hpp>

#include <iostream>
#include <thread>

class handler : public proton::messaging_handler {
public:
   handler(const std::string& u) 
   : m_url(u), m_work(0) 
   {}

   proton::work_queue* getWorkQueue() {
      if (!m_work)
         m_workProm.get_future().get();

      return m_work;
   }

   std::promise<void> m_closeProm;

private:
   void on_connection_open(proton::connection& c)override{
       m_work = &c.work_queue();
       m_workProm.set_value();
   }

   void on_connection_close(proton::connection&)override{
      m_closeProm.set_value();
   }

   std::string m_url;
   proton::work_queue* m_work;
   std::promise<void> m_workProm;
};

int main {
   try {
      std::string url("//127.0.0.1:5672");
      handler h(url);
      proton::container c(h);
      std::thread clientThread([&]() {
         try
         {
            c.run();
         }
         catch (const std::exception& e) {
            std::cerr << "Broker threw exception: " << e.what() << std::endl;
         }});

      proton::connection con = c.connect(url);
      h.getWorkQueue()->add([&]() {con.close(); });
      h.m_closeProm.get_future().get();
      con = proton::connection();
      if (clientThread.joinable())
      {
         clientThread.join();
      }
   }
   catch (std::exception& e) {
      std::cerr << e.what() << std::endl;
   }
   return 0;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to