Bug 985804

Summary: qpid-snmpd crash if qpidd not running
Product: Red Hat Enterprise MRG Reporter: Leonid Zhaldybin <lzhaldyb>
Component: qpid-snmpdAssignee: Ernie <eallen>
Status: CLOSED CURRENTRELEASE QA Contact: Eric Sammons <esammons>
Severity: high Docs Contact:
Priority: high    
Version: DevelopmentCC: esammons, iboverma, jross
Target Milestone: 3.0Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-snmpd-1.0.0-12.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-22 15:27:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
qpid-snmpd core dump file.
none
Capture exception cause when broker disconnects none

Description Leonid Zhaldybin 2013-07-18 09:33:29 UTC
Description of problem:
qpid-snmpd crashes if qpidd broker is not running, and some information is requested from qpid-snmpd. See attachment for the core dump.

[root@lzhaldyb-rhel64i qpidd]# service qpidd start
Starting Qpid AMQP daemon:                                 [  OK  ]
[root@lzhaldyb-rhel64i qpidd]# service qpid-snmpd start
Starting qpid-snmpd:                                       [  OK  ]
[root@lzhaldyb-rhel64i qpidd]# snmpget -v 2c -c public localhost brokerSystemSystemId.0
QPID-MESSAGING-MIB::brokerSystemSystemId.0 = STRING: 074e4fcc--c40-1-48-ae-8-39b-546b36c1bb67
[root@lzhaldyb-rhel64i qpidd]# service qpid-snmpd status
qpid-snmpd (pid 14798) is running...
[root@lzhaldyb-rhel64i qpidd]# service qpidd stop
Stopping Qpid AMQP daemon:                                 [  OK  ]
[root@lzhaldyb-rhel64i qpidd]# service qpid-snmpd status
qpid-snmpd (pid 14798) is running...
[root@lzhaldyb-rhel64i qpidd]# snmpget -v 2c -c public localhost brokerSystemSystemId.0
Timeout: No Response from localhost.
[root@lzhaldyb-rhel64i qpidd]# service qpid-snmpd status
qpid-snmpd dead but subsys locked

Version-Release number of selected component (if applicable):
qpid-snmpd-1.0.0-11.el6

How reproducible:
100%

Steps to Reproduce:
1. service qpidd start
2. service qpid-snmpd start
3. service qpidd stop
4. snmpget -v 2c -c public localhost brokerSystemSystemId.0

Actual results:
no response received by snmpget, qpid-snmpd crashes.

Expected results:
qpid-snmpd does not crash.

Additional info:

Comment 1 Leonid Zhaldybin 2013-07-18 09:41:29 UTC
Created attachment 775233 [details]
qpid-snmpd core dump file.

Comment 3 Ernie 2013-07-20 14:09:35 UTC
Created attachment 776172 [details]
Capture exception cause when broker disconnects

Comment 4 Ernie 2013-07-20 14:11:37 UTC
Committed and pushed a fix in version 1.0.0-12
- Captured exception thrown by qmf.query when broker is disconnected
- Returned SNMP_ERR_NOACCESS when a request is made and broker is disconnected
- Decreased net-snmp cache timeout from 60 seconds to 1 to prevent stale data from being returned when broker is disconnected

Note: qpid-snmpd responds differently when a request is made BEFORE the broker connects than it does when a request is made AFTER a broker is disconnected.
In both cases, there is no broker connection. But the response to a request is different.
Before: The request will timeout
After: A "no access" error will be returned

While not ideal, the changes needed to make the response the same in both cases would be extensive.

Comment 5 Leonid Zhaldybin 2013-08-06 08:28:24 UTC
Tested on RHEL6.4 (both i386 and x86_64). This issue has been fixed. In case that qpidd broker is not running, the qpid-snmpd daemon returns an error when snmp-get is received and continues running without a crash.

Packages used for testing:

python-qpid-0.22-4.el6
python-qpid-qmf-0.22-7.el6
qpid-cpp-client-0.22-8.el6
qpid-cpp-client-devel-0.22-8.el6
qpid-cpp-client-devel-docs-0.22-8.el6
qpid-cpp-client-ssl-0.22-8.el6
qpid-cpp-server-0.22-8.el6
qpid-cpp-server-devel-0.22-8.el6
qpid-cpp-server-ssl-0.22-8.el6
qpid-cpp-server-store-0.22-8.el6
qpid-cpp-server-xml-0.22-8.el6
qpid-java-client-0.22-5.el6
qpid-java-common-0.22-5.el6
qpid-java-example-0.22-5.el6
qpid-jca-0.18-8.el6
qpid-jca-xarecovery-0.18-8.el6
qpid-proton-c-0.4-2.2.el6
qpid-qmf-0.22-7.el6
qpid-snmpd-1.0.0-12.el6
qpid-tools-0.22-3.el6
rh-qpid-cpp-tests-0.22-8.el6

-> VERIFIED