Also, in the future if I have more than one subagent, should all subagents be
started in the same thread to be safe?
Need Help <[EMAIL PROTECTED]> wrote: Ok, I proved this is in fact the problem
causing our hardware box to coredump. If I remove the "while(keep_running)"
code (just for testing purposes), then everything comes up.
Anyway, I would now like to start the subagent in it's own thread but I am not
sure if this is "allowed" since there is a lot of mention of NetSNMP not being
"thread-safe". Does this mean the subagent and master agent should be started
in the same thread, or can I start the subagent in a thread of it's own and
still be safe?
Need Help <[EMAIL PROTECTED]> wrote: My subagent module (ie:
snmpSubagent_ocStbHostMib.c) has a "snmp_subagent_main()" routine which is
called to start up the subagent. This module was created based off of the
"example-demon.c" file used in the "Writing a Subagent" tutorial.
The module code looks like this:
int
snmp_subagent_main (int argc, char **argv) {
etc ...
etc ...
while(keep_running) {
/* if you use select(), see snmp_select_info() in snmp_api(3) */
/* --- OR --- */
agent_check_and_process(1); /* 0 == don't block */
}
snmp_shutdown("snmpSubagent_ocStbHostMib");
SOCK_CLEANUP;
return 0;
}
To start applications when our hardware box reboots, we have a special text
file which lists the applications (one per line) which should be started.
Basically, it lists which main routine should be called from which library (so)
file so the application can start. Our "GenInit()" method is called when the
box reboots which goes through this file line by line and calls the init
routine for each.
Here is the text file:
//libdiagnostics.so xmain
//libdct_tvguide.so EPGConstructor
//libsnmp_subagent.so snmp_subagent_main
** You can see the third line of the file indicates the subagent should be
started by calling the "snmp_subagent_main" init routine which is located in
the "libsnmp_subagent.so" library shared object file.
All applications (xmain, EPGConstrcutor and snmpSubagent) are requested to
start with no problem, however, the hardware box eventually crashes shortly
after...... but I "think" I know why.
The subagent is requested to start by the "GenInit()" method and since the
subagent has the "while (keep_running)" loop in it (see above), then I believe
control is never returned to the "GenInit()" method due to this forever loop.
As a result, I "think" the subagent code is starving other threads from
executing since this while loop goes on forever. This would cause the
hardware box to crash since nothing else can run.
I can try to start this "while (keep_running)" forever loop in it's own thread
so control can then be returned to the "GenInit()" method so it can then
continue processing, but I was wondering whether there is another way to try to
solve this?
I would assume other people have run into this problem so what do you
recommend? I am asknig the NetSNMP community this since there must be some
reason why the "while (keep_running)" loop exists in the main init function of
the subagent so I just do not think I should remove stuff from here without
asking whether this is the correct approach or not.
---------------------------------
Boardwalk for $500? In 2007? Ha!
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo!
Games.-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>
http://get.splunk.com/_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo!
FareChase.
---------------------------------
Boardwalk for $500? In 2007? Ha!
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo!
Games.-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>
http://get.splunk.com/_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo!
FareChase.
---------------------------------
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders