Bug 908661 - [RFE] QMF agent should warn / deny user while creation of object with the same object ID and not crash deep in qpid::management::ManagementAgentImpl::addObject (...)
Summary: [RFE] QMF agent should warn / deny user while creation of object with the sam...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-qmf
Version: 2.2
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
: ---
Assignee: messaging-bugs
QA Contact: MRG Quality Engineering
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-07 09:49 UTC by Frantisek Reznicek
Modified: 2025-02-10 03:27 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2025-02-10 03:27:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 759196 0 medium CLOSED clustered broker with management: broker: error Detected two management objects with the same identifier 2025-02-10 03:14:28 UTC

Internal Links: 759196

Description Frantisek Reznicek 2013-02-07 09:49:38 UTC
Description of problem:

QMF agent should warn / deny user while creation of object with the same object ID. There is no QMF agent check whether object with the same object ID is added to agent object pool. Detected on QMF v1 agent (attached).

Condition where generated object (Parent::Parent) inheriting from ManagementObject has the same ID (constructor's parameter name)

  Parent::Parent (ManagementAgent*, Manageable* _core, const std::string& _name) :
    ManagementObject(_core),name(_name)
  { ... }

is quite fatal condition and leads to QMF v1 agent SEGV crashes as demonstrates attached example:


  [root@amd-x-y qmf-agent]# FORCE_OBJNAME_ENA=1 ./qmf-agent localhost 5672 2 10 20 0 0 100 10
  loop 0/10(20) finished.
  ...
  loop 5/10(10) finished.
  Segmentation fault (core dumped)

looking at crash backtrace I'm always seeing crash quite deep in qpid::management::ManagementAgentImpl::addObject (...)

  Thread 1 (Thread 0x2b5428af5c60 (LWP 19722)):
  #0  0x0000000000408ef4 in _S_right (this=0x8c7c7d0, __x=0x12e08194257c8fe8)
      at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:501
  #1  std::_Rb_tree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, qpid::types::Variant>, std::_Select1st<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, qpid::types::Variant> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, qpid::types::Variant> > >::_M_erase (this=0x8c7c7d0, __x=0x12e08194257c8fe8)
      at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:1264
  #2  0x0000003fc8809676 in ~_Rb_tree (this=0x8c7d470, __in_chrg=<value optimized out>) at /usr/include/c++/4.1.2/bits/stl_tree.h:578
  #3  ~map (this=0x8c7d470, __in_chrg=<value optimized out>) at /usr/include/c++/4.1.2/bits/stl_map.h:93
  #4  qpid::types::VariantImpl::~VariantImpl (this=0x8c7d470, __in_chrg=<value optimized out>) at qpid/types/Variant.cpp:163
  #5  0x0000003fc8809fa1 in qpid::types::Variant::~Variant (this=<value optimized out>, __in_chrg=<value optimized out>)
      at qpid/types/Variant.cpp:680
  #6  0x00000000004132e0 in _M_erase (this=0x8c7c530, __in_chrg=<value optimized out>)
      at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_pair.h:69
  #7  ~_Rb_tree (this=0x8c7c530, __in_chrg=<value optimized out>)
      at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_tree.h:578
  #8  ~map (this=0x8c7c530, __in_chrg=<value optimized out>)
      at /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/stl_map.h:93
  #9  qmf::org::apache::qpid::agent::example::Parent::~Parent (this=0x8c7c530, __in_chrg=<value optimized out>)
      at gen/qmf/org/apache/qpid/agent/example/Parent.cpp:77
  #10 0x0000003fc9a12fef in operator= (this=<value optimized out>, object=<value optimized out>, key=<value optimized out>,
      persistent=<value optimized out>) at /usr/include/boost/detail/sp_counted_base_gcc_x86.hpp:145
  #11 operator= (this=<value optimized out>, object=<value optimized out>, key=<value optimized out>, persistent=<value optimized out>)
      at /usr/include/boost/shared_ptr.hpp:148
  #12 qpid::management::ManagementAgentImpl::addObject (this=<value optimized out>, object=<value optimized out>,
      key=<value optimized out>, persistent=<value optimized out>) at qpid/agent/ManagementAgentImpl.cpp:299
  #13 0x0000003fc9a1269b in qpid::management::ManagementAgentImpl::addObject (this=0x2b5428af7010, object=0x8c7bd50, persistId=0)
      at qpid/agent/ManagementAgentImpl.cpp:278
  #14 0x00000000004049ac in CoreClass::CoreClass (this=0x8c7dd70, _agent=<value optimized out>, _name=<value optimized out>)
      at example.cpp:95
  ...


I believe it is necessary to add check whether qpid::management::ManagementAgentImpl::addObject () adds object with same ID.
I propose to add additional ManagementAgent option which would by default perform that check resulting in for instance exception when adding same objects to QMF agent.
(Alternatively QMF agent may add to object unique hash which would allow to add objects with same ID, probably dangerous when querying them)


The testing scenario involved just QMF v1 agent, but I believe QMF v2 agent should also get this feature.


See details in attached example and below.

Version-Release number of selected component (if applicable):
qpid-0.14 and also qpid-0.18

How reproducible:
100%

Steps to Reproduce:
0. # install MRG/M packages
1. service qpidd start
2. make clean ; make
3. ./qmf-agent localhost 5672 2 10 20 0 0 100 10                      # all ok
4. FORCE_OBJNAME_ENA=1 ./qmf-agent localhost 5672 2 10 20 0 0 100 10  # crash
  
Actual results:
QMF agent may easily crash when managed object instances are having the same name.

Expected results:
QMF agent should not crash, as consequence of that: QMF should force that there are no objects with the same name / ID.

Comment 2 Frantisek Reznicek 2013-02-08 09:34:57 UTC
Proposed RFE should avoid errors like bug 759196.

Comment 5 Red Hat Bugzilla 2025-02-10 03:27:25 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.


Note You need to log in before you can comment on or make changes to this bug.