[pysnmp-users] PYSNMP crash in _com2sec with TypeError: __hash__() should return an int
Brought to you by:
elie
From: Abhishek L. <lah...@gm...> - 2015-11-21 06:28:14
|
Hi, My SNMP packages uses pysnmp for both sending /receiving SNMP queries and accept SNMP traps. However it seems to fail continuously after running successfully for some time. From the log I see : 2015-11-21 02:57:16,155 [8995] ERROR: SNMP Error:poll error: Traceback (most recent call last): ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/carrier/asynsock/dispatch.py", line 37, in runDispatcher use_poll=True, map=self.__sockMap, count=1) ; File "/usr/lib64/python2.6/asyncore.py", line 214, in loop poll_fun(timeout, map) ; File "/usr/lib64/python2.6/asyncore.py", line 195, in poll2 readwrite(obj, flags) ; File "/usr/lib64/python2.6/asyncore.py", line 119, in readwrite obj.handle_error() ; File "/usr/lib64/python2.6/asyncore.py", line 103, in readwrite obj.handle_read_event() ; File "/usr/lib64/python2.6/asyncore.py", line 428, in handle_read_event self.handle_read() ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/carrier/asynsock/dgram/base.py", line 83, in handle_read self._cbFun(self, transportAddress, incomingMessage) ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/carrier/base.py", line 52, in _cbFun self, transportDomain, transportAddress, incomingMessage ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/entity/engine.py", line 64, in __receiveMessageCbFun self, transportDomain, transportAddress, wholeMsg ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/rfc3412.py", line 319, in receiveMessage wholeMsg ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/mpmod/rfc2576.py", line 276, in prepareDataElements msg ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/secmod/rfc2576.py", line 398, in processIncomingMsg snmpEngine, communityName, transportInformation ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/secmod/rfc2576.py", line 260, in _com2sec if _tagAndCommunity not in self.__tagAndCommunityToSecurityMap: ;TypeError: __hash__() should return an int . Traceback (most recent call last): File "/opt/mysnmp-package/lib/python2.6/site-packages/automationtools_probe/monitoring_agent.py", line 69, in checkEvent lookupNames=True, lookupValues=True) File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/entity/rfc3413/oneliner/cmdgen.py", line 541, in nextCmd self.__asynCmdGen.snmpEngine.transportDispatcher.runDispatcher() File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/carrier/asynsock/dispatch.py", line 41, in runDispatcher raise PySnmpError('poll error: %s' % ';'.join(format_exception(*exc_info()))) PySnmpError: poll error: Traceback (most recent call last): ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/carrier/asynsock/dispatch.py", line 37, in runDispatcher use_poll=True, map=self.__sockMap, count=1) ; File "/usr/lib64/python2.6/asyncore.py", line 214, in loop poll_fun(timeout, map) ; File "/usr/lib64/python2.6/asyncore.py", line 195, in poll2 readwrite(obj, flags) ; File "/usr/lib64/python2.6/asyncore.py", line 119, in readwrite obj.handle_error() ; File "/usr/lib64/python2.6/asyncore.py", line 103, in readwrite obj.handle_read_event() ; File "/usr/lib64/python2.6/asyncore.py", line 428, in handle_read_event self.handle_read() ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/carrier/asynsock/dgram/base.py", line 83, in handle_read self._cbFun(self, transportAddress, incomingMessage) ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/carrier/base.py", line 52, in _cbFun self, transportDomain, transportAddress, incomingMessage ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/entity/engine.py", line 64, in __receiveMessageCbFun self, transportDomain, transportAddress, wholeMsg ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/rfc3412.py", line 319, in receiveMessage wholeMsg ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/mpmod/rfc2576.py", line 276, in prepareDataElements msg ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/secmod/rfc2576.py", line 398, in processIncomingMsg snmpEngine, communityName, transportInformation ; File "/opt/mysnmp-package/lib/python2.6/site-packages/pysnmp/proto/secmod/rfc2576.py", line 260, in _com2sec if _tagAndCommunity not in self.__tagAndCommunityToSecurityMap: ;TypeError: __hash__() should return an int If I turn on pysnmp debug I see the following. Looks like a null or empty community string is somehow getting populated but not sure how and if that is causing it to crash, tagAndCommunity (SnmpTagValue(''), OctetString('Secr3tPass')) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) tagAndCommunity (SnmpTagValue(''), OctetString('Secr3tPass')) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) tagAndCommunity (SnmpTagValue(''), OctetString('Secr3tPass')) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) tagAndCommunity (SnmpTagValue(''), OctetString('Secr3tPass')) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) tagAndCommunity (SnmpTagValue(''), OctetString()) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) Error __hash__() should return an int tagAndCommunity (SnmpTagValue(''), OctetString()) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) tagAndCommunity (SnmpTagValue(''), OctetString()) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) Error __hash__() should return an int tagAndCommunity (SnmpTagValue(''), OctetString()) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) tagAndCommunity (SnmpTagValue(''), OctetString()) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) Error __hash__() should return an int tagAndCommunity (SnmpTagValue(''), OctetString()) targetaddress MibTableColumn((1, 3, 6, 1, 6, 3, 12, 1, 2, 1, 3), TAddress()) TIA |