Andrew Agno <nets...@agno.net> writes:

> In particular, having my code log whenever MODE_SET_COMMIT is called, I see 
> that it gets called twice.  Is this
> expected behavior?  The FAQ mentions this can happen with get next/first, but 
> not on setting a value.
>
> One thing that I have noticed is that I can only reproduce this if I have an 
> event loop that pauses for a long time
> (using sleep(1), for example):
>
>   while(keep_running) {
>     while(agent_check_and_process(0) > 0) ; // need to call this in a loop or 
> things don't work
>     sleep(1);
>   }

The sleep will certainly cause issues because the manager likely has a
timeout set to retry sending a request.  And if it times out while
you're sleeping the manager will send a second SET request.  This can be
verified by using the -d switch, which dumps packets being sent.

The better way to do that loop is:

    while(keep_running) {
      agent_check_and_process(1);
    }

Setting the argument 1 to agent_check_and_process will cause it to block
and wait for packets, so you shouldn't need a sleep.

-- 
Wes Hardaker
Parsons

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to