Re: [pysnmp-users] cmdgen and SNMPv3
Brought to you by:
elie
From: Ilya E. <il...@gl...> - 2015-11-18 20:44:28
|
Oh, that might be a problem then. I’ve not noticed that advice. The good thing is that the parsing phase only happens once, then the result is put into $HOME/.pysnmp/mibs/ and only loaded from there. So you can potentially ‘bootstrap’ all MIBs from a single thread to compile them from ASN.1 source prior to use (there’s also the mibdump command-line tool). Or have a dedicated thread that only compiles newly required MIBs, other threads never compile anything but only load them up. I do not see much better solutions since we seem to hit ply’s limitation. What do you think? -ilya > On 15 Nov 2015, at 23:02, Vincent Bernat <be...@lu...> wrote: > > ❦ 15 novembre 2015 17:30 +0100, Vincent Bernat <be...@lu...> : > >> Since many stuff doesn't seem to be thread safe and that SnmpEngine is >> only parsing MIB stuff to get constant data, this part should be >> extracted to do it once. > > All the more than starting with PySNMP 4.3, MIBs are parsed/compiled > with PySMI. I can't say for sure, but is it safe to compile a MIB from > different threads? It seems that ply is not thread-safe. It is said: > > ╭─────┤ https://github.com/dabeaz/ply/blob/master/ply/yacc.py#L40-L45 ├───── > │The current implementation is only somewhat object-oriented. The > │LR parser itself is defined in terms of an object (which allows multiple > │parsers to co-exist). However, most of the variables used during table > │construction are defined in terms of global variables. Users shouldn't > │notice unless they are trying to define multiple parsers at the same > │time using threads (in which case they should have their head > │examined). > ╰───── > — |