etingof / snmpsim

SNMP Simulator

Home Page:http://snmplabs.com/snmpsim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

snmpsimd.py is crashing on startup

jacksitlab opened this issue · comments

snmp simulator is constantly crashing on startup with python error.
tested with python3.7 and 3.10 as base image.

worked some days ago.

 Listening at UDP/IPv4 endpoint 0.0.0.0:161, transport ID 1.3.6.1.6.1.1.0 
Shutting down variation modules: 
Variation module "delay" shutdown OK 
Variation module "notification" shutdown OK 
Variation module "subprocess" shutdown OK 
Variation module "redis" shutdown OK 
Variation module "writecache" shutdown OK 
Variation module "numeric" shutdown OK 
Variation module "error" shutdown OK 
Variation module "sql" shutdown OK 
Variation module "multiplex" shutdown OK 
Process terminated 
ERROR Traceback (most recent call last):; 
ERROR   File "/usr/local/lib/python3.7/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher;    use_poll=True, map=self.__sockMap, count=1); 
ERROR   File "/usr/local/lib/python3.7/asyncore.py", line 207, in loop;    poll_fun(timeout, map); 
ERROR   File "/usr/local/lib/python3.7/asyncore.py", line 188, in poll2;    readwrite(obj, flags); 
ERROR   File "/usr/local/lib/python3.7/asyncore.py", line 123, in readwrite;    obj.handle_error(); 
ERROR   File "/usr/local/lib/python3.7/asyncore.py", line 108, in readwrite;    obj.handle_read_event(); 
ERROR   File "/usr/local/lib/python3.7/asyncore.py", line 422, in handle_read_event;    self.handle_read(); 
ERROR   File "/usr/local/lib/python3.7/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read;    self._cbFun(self, transportAddress, incomingMessage); 
ERROR   File "/usr/local/lib/python3.7/site-packages/pysnmp/carrier/base.py", line 85, in _cbFun;    self, transportDomain, transportAddress, incomingMessage; 
ERROR   File "/usr/local/lib/python3.7/site-packages/pysnmp/entity/engine.py", line 152, in __receiveMessageCbFun;    self, transportDomain, transportAddress, wholeMsg; 
ERROR   File "/usr/local/lib/python3.7/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage;    msgVersion = verdec.decodeMessageVersion(wholeMsg); 
ERROR   File "/usr/local/lib/python3.7/site-packages/pysnmp/proto/api/verdec.py", line 17, in decodeMessageVersion;    recursiveFlag=False, substrateFun=lambda a, b, c: (a, b[:c]); 
ERROR   File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__;    for asn1Object in streamingDecoder:; 
ERROR   File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 1919, in __iter__;    self._substrate, self._asn1Spec, **self._options):; 
ERROR   File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 1781, in __call__;    self, substrateFun, **options):; 
ERROR   File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder;    for chunk in substrateFun(asn1Object, substrate, length, options):; 
ERROR TypeError: <lambda>() takes 3 positional arguments but 4 were given; 
ERROR ;During handling of the above exception, another exception occurred:;; 
ERROR Traceback (most recent call last):; 
ERROR   File "/usr/local/bin/snmpsimd.py", line 1466, in <module>;    transportDispatcher.runDispatcher(); 
ERROR   File "/usr/local/lib/python3.7/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 50, in runDispatcher;    raise PySnmpError('poll error: %s' % ';'.join(format_exception(*exc_info()))); 
ERROR pysnmp.error.PySnmpError: poll error: Traceback (most recent call last):;;  File "/usr/local/lib/python3.7/site-packages/pysnmp/carrier/asyncore/dispatch.py", line 46, in runDispatcher;    use_poll=True, map=self.__sockMap, count=1);;  File "/usr/local/lib/python3.7/asyncore.py", line 207, in loop;    poll_fun(timeout, map);;  File "/usr/local/lib/python3.7/asyncore.py", line 188, in poll2;    readwrite(obj, flags);;  File "/usr/local/lib/python3.7/asyncore.py", line 123, in readwrite;    obj.handle_error();;  File "/usr/local/lib/python3.7/asyncore.py", line 108, in readwrite;    obj.handle_read_event();;  File "/usr/local/lib/python3.7/asyncore.py", line 422, in handle_read_event;    self.handle_read();;  File "/usr/local/lib/python3.7/site-packages/pysnmp/carrier/asyncore/dgram/base.py", line 170, in handle_read;    self._cbFun(self, transportAddress, incomingMessage);;  File "/usr/local/lib/python3.7/site-packages/pysnmp/carrier/base.py", line 85, in _cbFun;    self, transportDomain, transportAddress, incomingMessage;;  File "/usr/local/lib/python3.7/site-packages/pysnmp/entity/engine.py", line 152, in __receiveMessageCbFun;    self, transportDomain, transportAddress, wholeMsg;;  File "/usr/local/lib/python3.7/site-packages/pysnmp/proto/rfc3412.py", line 291, in receiveMessage;    msgVersion = verdec.decodeMessageVersion(wholeMsg);;  File "/usr/local/lib/python3.7/site-packages/pysnmp/proto/api/verdec.py", line 17, in decodeMessageVersion;    recursiveFlag=False, substrateFun=lambda a, b, c: (a, b[:c]);;  File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 2003, in __call__;    for asn1Object in streamingDecoder:;;  File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 1919, in __iter__;    self._substrate, self._asn1Spec, **self._options):;;  File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 1781, in __call__;    self, substrateFun, **options):;;  File "/usr/local/lib/python3.7/site-packages/pyasn1/codec/ber/decoder.py", line 654, in valueDecoder;    for chunk in substrateFun(asn1Object, substrate, length, options):;;TypeError: <lambda>() takes 3 positional arguments but 4 were given;caused by <class 'TypeError'>: <lambda>() takes 3 positional arguments but 4 were given; 

already found the solution:

  • pyasn1 lib was updated on 20th of Apr 23 which seems to be incompatible with this lib
  • so set pyasn1<=0.4.8 to requirements.txt fixes the issue
commented

You might want to read etingof/pysnmp#429 to learn more.