Summary:ASTERISK-18091: Every "sip notify" cmd open a udptl port, and does not free it
Reporter:Kristijan Vrban (vrban)Labels:
Date Opened:2011-07-06 08:33:27Date Closed:2011-08-10 17:25:58
Versions:1.8.4 Frequency of
Description:Every "sip notify" cmd open a udptl port, and does not free it.
Comments:By: Kristijan Vrban (vrban) 2011-07-07 03:29:48.950-0500

And during understand this issue, in create_addr_from_peer i found the line
/* t38pt_udptl was enabled in the peer and not in [general] */
               if (dialog->udptl || (!dialog->udptl && (dialog->udptl = ast_udptl_new_with_bindaddr(sched, io, 0, &bindaddr)))) {

So for every SIP action, we open a UDPTL Port. Also for actions that will never need media (like in the case of NOTIFY's)
Is this intentional?

By: Kristijan Vrban (vrban) 2011-07-11 07:26:00.433-0500

also func "sip_cli_notify" is memleaking. see:
==21250== 1,398,064 bytes in 236 blocks are possibly lost in loss record 1,452 of 1,452
==21250==    at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==21250==    by 0x43FBC9: __ast_calloc (astmm.c:114)
==21250==    by 0x44023D: __ao2_alloc_debug (astobj2.c:293)
==21250==    by 0x1784FE5A: sip_alloc (chan_sip.c:7247)
==21250==    by 0x1789C0E4: sip_cli_notify (chan_sip.c:18147)
==21250==    by 0x481439: ast_cli_command_full (cli.c:2474)
==21250==    by 0x48167F: ast_cli_command_multiple_full (cli.c:2497)
==21250==    by 0x439609: netconsole (asterisk.c:1263)
==21250==    by 0x5399C8: dummy_start (utils.c:973)
==21250==    by 0x56E48B9: start_thread (pthread_create.c:300)
==21250== LEAK SUMMARY:
==21250==    definitely lost: 63,590 bytes in 266 blocks
==21250==    indirectly lost: 877,556 bytes in 4,209 blocks
==21250==      possibly lost: 7,398,210 bytes in 16,841 blocks
==21250==    still reachable: 1,090,182 bytes in 1,379 blocks
==21250==         suppressed: 0 bytes in 0 blocks
==21250== For counts of detected and suppressed errors, rerun with: -v
==21250== Use --track-origins=yes to see where uninitialised values come from
==21250== ERROR SUMMARY: 15426 errors from 1355 contexts (suppressed: 2817 from 18)

By: Kristijan Vrban (vrban) 2011-07-14 14:06:04.381-0500

This issue is very easy to reproduce. compile with Malloc Debug, then check the bytes and nummer of allocations in chan_sip via "memory show summary" then do some "sip notify" commands, then check again "memory show summary"

the allocations for sendeing the notify via "sip notify" cmd does not get freed.  

By: Kinsey Moore (kmoore) 2011-08-10 17:25:58.187-0500

The fix for this has been commited to 1.8, 10, and trunk.