Summary: | ASTERISK-17682: [patch] [regression] "sip prune" does not clean the relevant peer objects -> memleak | ||
Reporter: | Kristijan Vrban (vrban) | Labels: | |
Date Opened: | 2011-04-12 10:58:34 | Date Closed: | 2011-05-05 13:46:24 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Channels/chan_sip/General |
Versions: | 1.4.40 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Attachments: | ( 0) missing_regfree.patch ( 1) sip_object_counter.patch | |
Description: | a "sip prune realtime peer" cmd does not delete/clean the relevant Peer object. So if you extensively use "sip prune" cmd with sip realtime, you have a nice mem leak. on one of our asterisk e.g.: asterisk -rx'sip show objects' |grep static -= User objects: 1944 static, -359 realtime =- -= Peer objects: 833682 static, -832764 realtime, 0 autocreate =- so we have 833682! peer objects, but real peer number is 1944 (we prune only the peer) so asterisk use around 500MB with this 833682 Peer objects. | ||
Comments: | By: Kristijan Vrban (vrban) 2011-04-13 07:07:56 the error it not with older 1.4 version. just tested old 1.4.20.1 and this version does not have the error By: Kristijan Vrban (vrban) 2011-04-13 08:39:55 it's changeset 133488 from tilghman that caused this issue By: Kristijan Vrban (vrban) 2011-04-14 10:47:25 attched the patch for this leak: ==12158== 3,469,048 (56,448 direct, 3,412,600 indirect) bytes in 252 blocks are definitely lost in loss record 225 of 225 ==12158== at 0x4C244E8: malloc (vg_replace_malloc.c:236) ==12158== by 0x4C24562: realloc (vg_replace_malloc.c:525) ==12158== by 0x5BE8576: re_compile_internal (regcomp.c:760) ==12158== by 0x5BE88FB: regcomp (regcomp.c:506) ==12158== by 0x17A9D046: sip_prune_realtime (chan_sip.c:11678) ==12158== by 0x44E925: ast_cli_command (cli.c:2017) ==12158== by 0x44ED5D: ast_cli_command_multiple (cli.c:2056) ==12158== by 0x42683F: netconsole (asterisk.c:995) ==12158== by 0x4BA279: dummy_start (utils.c:856) ==12158== by 0x52378B9: start_thread (pthread_create.c:300) ==12158== ==12158== LEAK SUMMARY: ==12158== definitely lost: 120,968 bytes in 505 blocks ==12158== indirectly lost: 3,412,600 bytes in 12,057 blocks ==12158== possibly lost: 422,185 bytes in 1,117 blocks ==12158== still reachable: 134,634 bytes in 630 blocks ==12158== suppressed: 0 bytes in 0 blocks ==12158== Reachable blocks (those to which a pointer was found) are not shown. ==12158== To see them, rerun with: --leak-check=full --show-reachable=yes ==12158== ==12158== For counts of detected and suppressed errors, rerun with: -v ==12158== ERROR SUMMARY: 16852 errors from 50 contexts (suppressed: 3290 from 18) By: Kristijan Vrban (vrban) 2011-04-15 02:59:17 Attched the sip_object_counter.patch to fix the second issue, that loading realtime peers/user with rtcachefriends=yes increase the static peer/user objects counter (speerobjs/suserobjs) And "sip prune" decrease the counter for realtime peer/user objects (rpeerobjs,ruserobjs) which leads to the effect, that the counter for rpeerobjs and ruserobjs becomes negativ. Based on the assumption, it is intentional, that if rtcachefriends is yes, then the realtime peers/user are counted as static peers/users? By: Kristijan Vrban (vrban) 2011-04-15 03:10:13 The regfree is also missing in all other asterisk version. Not only 1.4 By: Digium Subversion (svnbot) 2011-05-05 13:20:31 Repository: asterisk Revision: 317211 U branches/1.4/channels/chan_sip.c ------------------------------------------------------------------------ r317211 | russell | 2011-05-05 13:20:31 -0500 (Thu, 05 May 2011) | 15 lines chan_sip: fix broken realtime peer count, fix memory leak This patch addresses two bugs in chan_sip: 1) The count of realtime peers and users was off. The increment checked the value of the caching option, while the decrement did not. 2) Add a missing regfree() for a regex. (closes issue ASTERISK-17682) Reported by: vrban Patches: missing_regfree.patch uploaded by vrban (license 756) sip_object_counter.patch uploaded by vrban (license 756) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=317211 By: Digium Subversion (svnbot) 2011-05-05 13:29:58 Repository: asterisk Revision: 317255 _U branches/1.6.2/ U branches/1.6.2/channels/chan_sip.c ------------------------------------------------------------------------ r317255 | russell | 2011-05-05 13:29:57 -0500 (Thu, 05 May 2011) | 22 lines Merged revisions 317211 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r317211 | russell | 2011-05-05 13:20:29 -0500 (Thu, 05 May 2011) | 15 lines chan_sip: fix broken realtime peer count, fix memory leak This patch addresses two bugs in chan_sip: 1) The count of realtime peers and users was off. The increment checked the value of the caching option, while the decrement did not. 2) Add a missing regfree() for a regex. (closes issue ASTERISK-17682) Reported by: vrban Patches: missing_regfree.patch uploaded by vrban (license 756) sip_object_counter.patch uploaded by vrban (license 756) ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=317255 By: Digium Subversion (svnbot) 2011-05-05 13:39:45 Repository: asterisk Revision: 317281 _U branches/1.8/ U branches/1.8/channels/chan_sip.c ------------------------------------------------------------------------ r317281 | russell | 2011-05-05 13:39:44 -0500 (Thu, 05 May 2011) | 29 lines Merged revisions 317255 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r317255 | russell | 2011-05-05 13:29:53 -0500 (Thu, 05 May 2011) | 22 lines Merged revisions 317211 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r317211 | russell | 2011-05-05 13:20:29 -0500 (Thu, 05 May 2011) | 15 lines chan_sip: fix broken realtime peer count, fix memory leak This patch addresses two bugs in chan_sip: 1) The count of realtime peers and users was off. The increment checked the value of the caching option, while the decrement did not. 2) Add a missing regfree() for a regex. (closes issue ASTERISK-17682) Reported by: vrban Patches: missing_regfree.patch uploaded by vrban (license 756) sip_object_counter.patch uploaded by vrban (license 756) ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=317281 By: Digium Subversion (svnbot) 2011-05-05 13:46:23 Repository: asterisk Revision: 317282 _U trunk/ U trunk/channels/chan_sip.c ------------------------------------------------------------------------ r317282 | russell | 2011-05-05 13:46:23 -0500 (Thu, 05 May 2011) | 36 lines Merged revisions 317281 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ................ r317281 | russell | 2011-05-05 13:39:44 -0500 (Thu, 05 May 2011) | 29 lines Merged revisions 317255 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ................ r317255 | russell | 2011-05-05 13:29:53 -0500 (Thu, 05 May 2011) | 22 lines Merged revisions 317211 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r317211 | russell | 2011-05-05 13:20:29 -0500 (Thu, 05 May 2011) | 15 lines chan_sip: fix broken realtime peer count, fix memory leak This patch addresses two bugs in chan_sip: 1) The count of realtime peers and users was off. The increment checked the value of the caching option, while the decrement did not. 2) Add a missing regfree() for a regex. (closes issue ASTERISK-17682) Reported by: vrban Patches: missing_regfree.patch uploaded by vrban (license 756) sip_object_counter.patch uploaded by vrban (license 756) ........ ................ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=317282 |