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

John McCaskey jmccaskey at gmail.com
Mon Mar 13 19:36:46 CET 2006


Hello,

I've recently started looking into SNMP++ and Agent++ as potential
replacements for my companies current use of Net-SNMP since Net-SNMP is not
thread safe for SNMP v3.  Unfortunately I seem to be experiencing a crashing
issue with SNMP++.

Here is what I am doing in my app:

1) Initialize SNMP++ in the main thread prior to other thread creation
(Snmp::socket_start, getBootCounter(), saveBootCounter, new v3MP(..) which
is saved as a global object)

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 as I'm just getting a
pointer via the already initialized v3_MP that is global and intialized in
my main thread.  However, I am getting crashes at line 1262 of usm_v3.cpp.
The code there is inside the USM::get_user call and is:
res->engineID           = user_table_entry->usmUserEngineID;

The problem seems to be that user_table_entry is NULL.  Right above the line
that crashses there is a check that res is not null, but no check on
user_table_entry.

Can anyone offer any suggestions?  I'm not immediately seeing anything I've
done wrong and it seems like a library bug, but I've just started working
with the library so I could very well be missing something obvious.

John



More information about the AGENTPP mailing list