I have added both changes but eventually, it crashes in my subagent RMON when I continuously setting/getting data in a loop.
Thanks Fong -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Won-Sik Kim Sent: Friday, August 06, 2004 10:13 PM To: Fong Tsui; [EMAIL PROTECTED] Cc: Penz, Bernhard Subject: Re: Re: Re: Bug report and Rqeust for confirm (about memory leaks on SET) Hi Fong, It is true that there is crash. I tested rstory's solution with set script(set script sends set requests continuously). And, crash occurs time to time. (a crash per 10000 set requests...? ... hmm... I can not say exact crash rate, because crash occurs randomly) I have not got any response about my solution "#define MIB_CLIENTS_ARE_EVIL 0" from anybody yet. But, from my case, my solution works. No memory leak, nor crash. Regards, Won-Sik Kim ----- Original Message ----- From: "Fong Tsui" <[EMAIL PROTECTED]> To: "Won-Sik Kim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: "Penz, Bernhard" <[EMAIL PROTECTED]> Sent: Saturday, August 07, 2004 2:14 AM Subject: RE: Re: Bug report and Rqeust for confirm (about memory leaks on SET) Hi, Won-Sik, I had the same problem, memory leak when SET data in subagent. Today, I tried updated cvs source, it seems not being fixed, neither 5.1.2.rc2 or 5.0-patches. :-( Currently, I did what rstory suggested, comment out the line 'asp->pdu->variables = NULL; On my system, it doesn't crash. However, it worries me if there is potential crash. Have you heard from anybody for your fix, #define MIB_CLIENTS_ARE_EVIL 0? According to rstory, it may be double free, in that case, the crash may occur at different places? Thanks, Fong -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Won-Sik Kim Sent: Saturday, July 24, 2004 8:54 PM To: [EMAIL PROTECTED] Cc: Penz, Bernhard Subject: Re: Re: Bug report and Rqeust for confirm (about memory leaks on SET) Hi, I tested my agent to check memory leaks on agentx subagent for SET requests. Unfortunately, with my patch, still memory leaks occur. So, I dug into it Yesterday. And, I found out no crash and no memory leak solution(?) for subagent's SET memory leak. Actually, Mr. rstory already found out the way of avoiding memory leak. "in the function save_set_cache() in agent/snmp_agent.c, comment out the line 'asp->pdu->variables = NULL;'." But, as Mr. rstory already mentioned, this solution causes crash. So, I traced it. And, I found that subagent crashed in function netsnmp_old_api_helper() of file helpers/old_api.c. In file helpers/old_api.c, there is a definition '#define MIB_CLIENTS_ARE_EVIL 1' I have no idea what is the meaning of this definition, but, it seems like for debug or something like that for me(it looks like not important) So, I change it as '#define MIB_CLIENTS_ARE_EVIL 0'. And then, crashes disappeared. So, everybody, please test agentX SET request with following two changes 1. "in the function save_set_cache() in agent/snmp_agent.c, comment out the line 'asp->pdu->variables = NULL;'." -- from Mr. rstory 2. '#define MIB_CLIENTS_ARE_EVIL 0'. -- from Won-Sik Kim If somebody who know about definition MIB_CLIENTS_ARE_EVIL, let me know. I am not sure it is OK or not if I change the MIB_CLIENTS_ARE_EVIL as 0. By the way, above solution seem like fine for me until now. Best regards, Won-Sik Kim ----- Original Message ----- From: "Penz, Bernhard" <[EMAIL PROTECTED]> To: "Won-Sik Kim" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, July 23, 2004 9:57 PM Subject: RE: Bug report and Rqeust for confirm Hi, Could you also write a small test-Agent that checks if this also makes the memory leaks for SET requests disappear (Bug 916605)? The leak there is quite noticable, the agentx agent leaks about 4k for every SET. I am going to check your patch next week under windows. It would be nice if you can send a "diff -u" patch, that makes it easier for everybody to apply your changes. Regards Bernhard PS: Dunno if you can convince hotmail not to send HTML mails, but to quote Dave: Please - no HTML mail. Thanks ________________________________ From: Won-Sik Kim [mailto:[EMAIL PROTECTED] Sent: Freitag, 23. Juli 2004 09:27 To: [EMAIL PROTECTED] Subject: Bug report and Rqeust for confirm Hi all, I use net-snmp-5.1.1 on Linux with agentX for developing multi device system. I suffered from following three problems. 1. memory leak in master agent if manager sends many getbulk requests at once. 2. crash of master agent happens time to time if manager sends many getnext requests 3. some times, response from master agent slows down, but, if I wait, if get back to normal status. I already reported 1st problem. But, my question was too vague to get response. I debugged and traced net-snmp for a week, and find out which source code causes 2nd problem(crash) The bug was in function netsnmp_check_outstanding_agent_requests(). (in file snmp_agent.c) I only remove 1 line from the function. (line 24 in followed source code) And, problem solved... There was a possibility of referencing to freed netsnmp_agent_session structure. My explanations : prev_asp is last asp (prev_asp = asp) - line 9 in followed source code But, if you trace function check_delayed_request(asp) - line 40 in followed source code asp can be freed. (of course, pointer itself is not NULL) This means, code "prev_asp->next = " can crash master agent. asp is freed by this way. (trace sequence) check_delayed_request(asp) - line 40 in followed source code netsnmp_wrap_up_request(asp) netsnmp_remove_and_free_agent_snmp_session(asp) free_agent_snmp_session(asp) SNMP_FREE(asp); As you know, SNMP_FREE(asp) does "asp = NULL", but, asp is parsed as pointer, so this NULLing can not help anything to code "if (prev_asp != NULL)" - line 16 in followed source code Finally, "prev_asp->next = asp->next" causes crash. (not always though) I was not sure what "prev_asp->next = asp->next" really does. So, for test, I just removed it first. And then, amazingly, this removing solved not only 2nd problem(crash), but also 1st(memory leak), and 3rd(slow down) !! And, there is no problem in get, getnext, getbulk and set !! After this change, no more crash, no more memory leak and no more slow down. Here are my requests. 1. Can somebody confirm my change ? I just remove one line, but, I am wonder if this removing causes other problem... (I can not find yet though) 2. If I am right, this change must be included in next release(5.1.2) I will wait for answer. Best regards, Won-Sik Kim 1 void 2 netsnmp_check_outstanding_agent_requests(void) 3 { 4 netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL; 5 6 /* 7 * deal with delegated requests 8 */ 9 for (asp = agent_delegated_list; asp; prev_asp = asp, asp = next_asp) { 10 next_asp = asp->next; /* save in case we clean up asp */ 11 if (!netsnmp_check_for_delegated(asp)) { 12 13 /* 14 * we're done with this one, remove from queue 15 */ 16 if (prev_asp != NULL) 17 { 18 #if 0 /* by wonsikkim on 2004-07-22 to solve crash on master agent problem */ 19 /* Funny thing is by this change, other two major problems also solved */ 20 /* So, this change fix following three bugs at once. */ 21 /* 1. master agent crash during processing a lot of getnext requests */ 22 /* 2. master agent slow down sometimes during processing requests */ 23 /* 3. memory leak if process a lot of getbulk requests */ 24 prev_asp->next = asp->next; 25 #endif 26 } 27 else 28 { 29 agent_delegated_list = asp->next; 30 } 31 32 /* 33 * check request status 34 */ 35 netsnmp_check_all_requests_status(asp, 0); 36 37 /* 38 * continue processing or finish up 39 */ 40 check_delayed_request(asp); 41 } 42 } NHS��SX�s�Su�nZ?ŮK�'B����+'au�-S��-��*��y��?l�?ŮK�Y�?���v�vw>�?�- N�HS^��sSX��s'�S�u�ZI1?j�����'v�^r���(oe���(~"�jv�z� ���jV�tװ�Z+�觶�j�_{ zK � 'zj+y��r���hjy�wY�zz09$�:-�J<�q��r�-^2�.�*&z�z�oe...��z�'��{'Lk"��0�<-��&5�lzj\��f�-)�-+-5�lzj\��X���(��~S�zw�?�i���S�l�<�q�� �z��S�l�X��)ߣ���� ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Net-snmp-coders mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
