ISISComputingGroup / IBEX

Top level repository for IBEX stories
5 stars 2 forks source link

database server: unpin pysnmp-lextudio #8271

Open rerpha opened 6 months ago

rerpha commented 6 months ago

Currently if you use 6.0.x of pysnmp-lextudio (required for the snmp moxa stats part of the database server) you get an error essage like this:

[Mon Mar 18 11:12:28 2024] Exception in thread Thread-1 (_update_snmp):

[Mon Mar 18 11:12:28 2024] Traceback (most recent call last):

[Mon Mar 18 11:12:28 2024]   File "C:\Instrument\Apps\Python3\Lib\threading.py", line 1045, in _bootstrap_inner

[Mon Mar 18 11:12:28 2024]     self.run()

[Mon Mar 18 11:12:28 2024]   File "C:\Instrument\Apps\Python3\Lib\threading.py", line 982, in run

[Mon Mar 18 11:12:28 2024]     self._target(*self._args, **self._kwargs)

[Mon Mar 18 11:12:28 2024]   File "C:\Instrument\Apps\EPICS\ISIS\inst_servers\master\DatabaseServer\moxa_data.py", line 148, in _update_snmp

[Mon Mar 18 11:12:28 2024]     mibmap = walk(ip_addr, <removed> SYSTEM_MIBS + PORT_MIBS)

[Mon Mar 18 11:12:28 2024]              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[Mon Mar 18 11:12:28 2024]   File "C:\Instrument\Apps\EPICS\ISIS\inst_servers\master\server_common\snmpWalker.py", line 23, in walk

[Mon Mar 18 11:12:28 2024]     varBinds) in nextCmd(SnmpEngine(),

[Mon Mar 18 11:12:28 2024]                  ^^^^^^^^^^^^^^^^^^^^^

[Mon Mar 18 11:12:28 2024]   File "C:\Instrument\Apps\Python3\Lib\site-packages\pysnmp\hlapi\asyncio\sync\cmdgen.py", line 271, in nextCmd

[Mon Mar 18 11:12:28 2024]     loop = asyncio.get_event_loop()

[Mon Mar 18 11:12:28 2024]            ^^^^^^^^^^^^^^^^^^^^^^^^

[Mon Mar 18 11:12:28 2024]   File "C:\Instrument\Apps\Python3\Lib\asyncio\events.py", line 677, in get_event_loop

[Mon Mar 18 11:12:28 2024]     raise RuntimeError('There is no current event loop in thread %r.'

[Mon Mar 18 11:12:28 2024] RuntimeError: There is no current event loop in thread 'Thread-1 (_update_snmp)'.

We should look and see if we can use v6 onwards as it's not a good idea to pin dependencies!

https://github.com/lextudio/pysnmp/issues/49 is tracking this

Time in planning

1:25:50 4/4/24 also discussed briefly 02/05/2024

Time in planning meeting (18/07/24)

03:05 Agreed to take with dependency updates ticket next time round as issue linked above now closed

FreddieAkeroyd commented 6 months ago

I think pysnmp-lextudio has moved to using python asyncio, as we run the snmp refresh in a separate thread we may need to follow the guidance as per
https://stackoverflow.com/questions/46727787/runtimeerror-there-is-no-current-event-loop-in-thread-in-async-apscheduler and create a separate event loop for the asyncio events even after upstream fixes - it depends if they will allow for this way of running within the package itself