On 6 October 2012 09:12, Bradley Kite <[email protected]> wrote:
> Hi,
>
> I am testing/debugging a network application heap corruption bug (the
> application is also an AgentX subagent), and valgrind is reporting this
> error - which I suspect might be the cause of the problem:
>
> ==5608== Thread 9:
> ==5608== Invalid read of size 8
> ==5608== at 0x4CFF13: handle_subagent_response (subagent.c:550)
> ==5608== by 0x4FB8E3: _sess_process_packet (snmp_api.c:5518)
> ==5608== by 0x4FCFC0: _sess_read (snmp_api.c:6043)
> ==5608== by 0x4FDCA8: snmp_sess_read2 (snmp_api.c:6075)
> ==5608== by 0x4FDD42: snmp_read2 (snmp_api.c:5667)
> ==5608== by 0x4C142A: agent_check_and_process (snmp_agent.c:668)
> ==5608== by 0x47AE95: snmp_loop(void*) (authent.cpp:1609)
> ==5608== by 0x3095007D13: start_thread (in /usr/lib64/
> libpthread-2.15.so)
> ==5608== by 0x30948F167C: clone (in /usr/lib64/libc-2.15.so)
> ==5608== Address 0x4e24c00 is 0 bytes inside a block of size 408 free'd
> ==5608== at 0x4A079AE: free (vg_replace_malloc.c:427)
> ==5608== by 0x4F7877: snmp_sess_close (snmp_api.c:2047)
> ==5608== by 0x4F7D62: snmp_sess_select_info2 (snmp_api.c:6207)
> ==5608== by 0x4C13EF: agent_check_and_process (snmp_agent.c:638)
> ==5608== by 0x47AE95: snmp_loop(void*) (authent.cpp:1609)
> ==5608== by 0x3095007D13: start_thread (in /usr/lib64/
> libpthread-2.15.so)
> ==5608== by 0x30948F167C: clone (in /usr/lib64/libc-2.15.so)
>
> I am able to reliably reproduce this by rapidly querying the agent, then
> restarting the snmpd service on the host, which suggests that the problem
> occurs when the subagent looses its connection to the master.
>
> Any help in fixing this would be greatly appreciated.
>
> Regards
> --
> Brad.
>
In trying to narrow this down, it would appear that when the session is
closed (due to the master agent being shutdown), the following read uses
the previous session's struct snmp_internal_session (*isp) data, so the
"magic" (in the isp->callback_data) does not seem right.
When the session is closed (in snmp_sess_close()) should the
snmp_internal_session have its entry removed?
This is my first time working in the internals of net-snmp so any help
would be appreciated.
Thanks in advance.
--
Brad.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders