Thomas Anders wrote:
> Josef Moellers wrote on 2006-11-03:
>
>>During analysis, I already tried *not* freing certain data structures to
>>see how far I got and the first thing I did was deepcopying a
>>netsnmp_subtree rather than assigning the pointer in
>>netsnmp_add_varbind_to_cache() (request->subtree, and later
>>request->range_end).
>>This fixed stale references to subtrees later.
>>
>>When I re-arrange the code (first netsnmp_remove... fo session _and_ its
>>subtrees, then unregister_*_by_session), this cause for an snmpd crash
>>is gone.
>>
>>However, I still get a crash in
>>netsnmp_handler_mark_requests_as_delegated() where a requests pointer is
>>stale.
>>
>>This can be "fixed" by not freeing asp->requests in
>>free_agent_snmp_session(), but this will, most likely, result in a
>>merory leak.
>>
>>These crashes occur when a SNMPGET(NEXT?) arrives with more than one OID
>>and the agentx subagent does not respond.
>
>
> Now that a proposed patch has been uploaded to
>
> http://sf.net/tracker/index.php?func=detail&aid=1641685&group_id=12694&atid=312694
>
> could you please comment on whether/how the proposed patch deals with
> the "open issues" mentioned above?
Apparently the stale session->myvoid pointer fouled things up pretty
badly: I traced the calls to free(session->myvoid) and I found that it
was called twice with the very same address, without new
mallocs/assignments in register_agentx_list(). When this happened, snmpd
crashed at varying other places where dynamically allocated structures
were handled.
Once I replaced the simple freeing of the pointer by a "call" to the
SNMP_FREE macro (as is done in the uploaded patch), which also _clears_
the session->myvoid pointer, no more crashes (which definitely were
reproducable) were observed even when testing the patched
snmpd/libraries over a prolonged period of time.
Josef
--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders