Thanks Dave for the quick clarification.  The hooks(xxx_load, xxx_free) and the 
handler are called sequentially from the same thread.
I am getting this doubt as I found that strlen() is crashing on Solaris 
10(*only*) and that is only if I run the sub-agent as  master agent. It works 
well when it runs as sub-agent of snmpd. I am sure xxx_load() has properly 
created the memory. messageId is char* , It can be quite long and null 
terminated .

This is with Net-SNMP(5.4) . do you see any issue ?


case MODE_GET:
       for (request=requests; request; request=request->next) {
           table_entry = (struct messageTable_entry *)
                             netsnmp_extract_iterator_context(request);
           table_info  =     netsnmp_extract_table_info(      request);
           if ( !table_entry ) {
               netsnmp_set_request_error(reqinfo, request,
                                         SNMP_NOSUCHINSTANCE);
               continue;
           }
           switch (table_info->colnum) {
           case COLUMN_messageID:
               snmp_set_var_typed_value( request->requestvb, ASN_OCTET_STR,
                                         (u_char*)table_entry->messageId,
                                         strlen(table_entry->messageId));



________________________________
From: Dave Shield <[email protected]>
To: sujata patra <[email protected]>
Cc: net-snmp-coders <[email protected]>
Sent: Thu, February 24, 2011 2:30:47 PM
Subject: Re: Transient Data ?

On 24 February 2011 06:35, sujata patra <[email protected]> wrote:
> If I use cache , is it a concern?

No.

>                           The time handler is processing a request
> and expiry of cahe can free the data at the same time . right ?

No.
The check on whether the cache is valid is done once,
*before* calling the iterator hooks, and then the handler itself.
If the cache timeout hasn't expired (even by a nanosecond),
then this check will pass, and the cache won't be reloaded.

The iterator hooks and the handler will not subsequently
check the cache timeout - they assume this has already been done.
So the cache contents will remain valid for the processing of that
request - even if the expiry timeout has since elapsed.

But the *next* incoming request (possibly part of the same
"snmpwalk" command) _will_ trigger the cache timeout and reload.

Dave



      
------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to