[AGENT++] Crash in multi-threaded SNMP++ use (usm_v3.cpp:1262)

Dale Swanston swanston at sedsystems.ca
Mon Mar 13 22:48:59 CET 2006



Jochen Katz wrote:
> Hi John,
>
>   
>> 2) In each individual thread (the application creates about 80 threads
>> dedicated to polling individual SNMP enabled devices) I create a new Snmp
>> object and intialize it with the right settings, as part of this if the
>> device to be polled is SNMP v3 then I do:
>> USM *usm = v3_MP->get_usm();
>> usm->add_usm_user(device.snmp_configuration.version3.snmp_username,
>>                 authProtocol, privProtocol,
>>                 device.snmp_configuration.version3.snmp_auth_password,
>>                 device.snmp_configuration.version3.snmp_priv_password);
>>     
>
>   
>> It's my understanding this should be thread safe
>>     
>
> yes it should be thread safe, but it is not. As it isn't a simple
> lock/unlock issue you have to use the following temporary workaround
> until I can provide a fixed version.
> Add Snmp::v3Lock.lock(); and Snmp::v3Lock.unlock(); around the call to
> add_usm_user()
Are there other cases in the latest versions of agent++/snmp++ where 
such a work around should be in place?  Are they documented anywhere (I 
googled but didn't come up with anything)?

Dale Swanston

BTW - thanks to Jochen for the quality responses on this forum - very 
helpful.  Much appreciated.



More information about the AGENTPP mailing list