sync: running multiple get() calls results in TimeoutError
example code:
from netsnmpy import netsnmp, session
from time import sleep
netsnmp.load_mibs()
sess = session.SNMPSession("127.0.0.1", version="v2c", community="public")
sess.open()
varbinds = sess.get(netsnmp.symbol_to_oid("sysDescr.0"))
sleep(20)
varbinds2 = sess.get(netsnmp.symbol_to_oid("sysName.0"))
sess.close()
Running this code returns a TimeoutError on the last call to sess.get()
traceback:
(.venv) --> $ python3 fail_num_sessions.py
MIB search path: /home/runarb/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf
Traceback (most recent call last):
File "/home/runarb/netsnmp-cffi/src/netsnmpy/programs/fail_num_sessions.py", line 10, in <module>
varbinds2 = sess.get(netsnmp.symbol_to_oid("sysName.0"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runarb/netsnmp-cffi/.venv/lib/python3.12/site-packages/netsnmpy/session.py", line 152, in get
return asyncio.run(self.aget(*oids))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/runarb/netsnmp-cffi/.venv/lib/python3.12/site-packages/netsnmpy/session.py", line 157, in aget
return await self._send_async(request, "get")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TimeoutError