[Freeswitch-dev] Memory Leak Patch
Michael Jerris
mike at jerris.com
Thu May 22 00:58:40 MSD 2014
So correct me if I'm wrong, this looks like leak on timeout on provisional reply? I don't think we have this one fixed...
On May 21, 2014, at 8:49 PM, Jerry Richards <jerry.richards at teotech.com> wrote:
> Here is the patch made to the latest (today's) Freeswitch stable branch (did you fix this leak in a differently somewhere else?):
>
> *** C:\work\SipBugs\Phone\MemoryLeak\fs_stable\nta_ORIGINAL.c 2014-02-20 18:43:27.000000000 -0700
> --- C:\work\SipBugs\Phone\MemoryLeak\fs_stable\nta_PATCHED.c 2014-05-21 12:14:39.000000000 -0700
> ***************
> *** 9166,9175 ****
> --- 9166,9187 ----
> }
>
> return orq;
> }
>
> /** destroy msg if no timeout set on receive outgoing */
> + int check_outgoing_recv_timeout(nta_outgoing_t *original, msg_t *msg)
> + {
> + SU_DEBUG_5(("nta %s: orq_timeout=%d.\n","check_outgoing_recv_timeout",original->orq_timeout));
> + if(original->orq_timeout==0){
> + outgoing_remove(original);
> + msg_destroy(msg);
> + return 0;
> + }
> + return original->orq_timeout;
> + }
>
> /** Process a response message. */
> int outgoing_recv(nta_outgoing_t *_orq,
> int status,
> msg_t *msg,
> sip_t *sip)
> ***************
> *** 9232,9248 ****
> --- 9244,9264 ----
> original->orq_status = status;
> if (orq->orq_status < 200)
> orq->orq_status = status;
>
> if (original->orq_queue == sa->sa_out.inv_calling) {
> outgoing_queue(sa->sa_out.inv_proceeding, original);
> + if(check_outgoing_recv_timeout(original,msg)==0)
> + return 0;
> }
> else if (original->orq_queue == sa->sa_out.inv_proceeding) {
> if (sa->sa_out.inv_proceeding->q_timeout) {
> outgoing_remove(original);
> outgoing_queue(sa->sa_out.inv_proceeding, original);
> + if(check_outgoing_recv_timeout(original,msg)==0)
> + return 0;
> }
> }
>
> /* Handle 100rel */
> if (sip && sip->sip_rseq) {
> if (outgoing_recv_reliable(orq, msg, sip) < 0) {
>
>
> Here is the patch made to the latest (today's) Freeswitch master branch (did you fix this leak in a differently somewhere else?):
>
> *** C:\work\SipBugs\Phone\MemoryLeak\fs_master\nta_ORIGINAL.c 2014-02-20 18:45:34.000000000 -0700
> --- C:\work\SipBugs\Phone\MemoryLeak\fs_master\nta_PATCHED.c 2014-05-21 12:17:54.000000000 -0700
> ***************
> *** 9307,9316 ****
> --- 9307,9328 ----
> }
>
> return orq;
> }
>
> /** destroy msg if no timeout set on receive outgoing */
> + int check_outgoing_recv_timeout(nta_outgoing_t *original, msg_t *msg)
> + {
> + SU_DEBUG_5(("nta %s: orq_timeout=%d.\n","check_outgoing_recv_timeout",original->orq_timeout));
> + if(original->orq_timeout==0){
> + outgoing_remove(original);
> + msg_destroy(msg);
> + return 0;
> + }
> + return original->orq_timeout;
> + }
>
> /** Process a response message. */
> int outgoing_recv(nta_outgoing_t *_orq,
> int status,
> msg_t *msg,
> sip_t *sip)
> ***************
> *** 9373,9389 ****
> --- 9385,9405 ----
> original->orq_status = status;
> if (orq->orq_status < 200)
> orq->orq_status = status;
>
> if (original->orq_queue == sa->sa_out.inv_calling) {
> outgoing_queue(sa->sa_out.inv_proceeding, original);
> + if(check_outgoing_recv_timeout(original,msg)==0)
> + return 0;
> }
> else if (original->orq_queue == sa->sa_out.inv_proceeding) {
> if (sa->sa_out.inv_proceeding->q_timeout) {
> outgoing_remove(original);
> outgoing_queue(sa->sa_out.inv_proceeding, original);
> + if(check_outgoing_recv_timeout(original,msg)==0)
> + return 0;
> }
> }
>
> /* Handle 100rel */
> if (sip && sip->sip_rseq) {
> if (outgoing_recv_reliable(orq, msg, sip) < 0) {
>
> I realized the mailing list does not accept attachments, so I put the patches in-line here.
>
> Jerry
>
> -----Original Message-----
> From: freeswitch-dev-bounces at lists.freeswitch.org [mailto:freeswitch-dev-bounces at lists.freeswitch.org] On Behalf Of Ken Rice
> Sent: Wednesday, May 21, 2014 1:37 PM
> To: freeswitch-dev at lists.freeswitch.org
> Subject: Re: [Freeswitch-dev] Memory Leak Patch
>
> You should really check the lastest version... I believe those were patched ages ago...
>
>
> On 5/21/14 3:29 PM, "Jerry Richards" <jerry.richards at teotech.com> wrote:
>
>> We patched sofia-sip version 1.12.11 for memory leaks we found in sofia-sip.
>> It's related to memory allocated for provisional replies to outbound
>> INVITE transactions which never get freed. I suspect Freeswitch has
>> the same issue, so I created a patch file (attached) for each of the
>> latest (as of today) libs/sofia-sip/libsofia-sip-ua/nta/nta.c file in
>> both the stable and master Freeswitch branches.
>>
>> Do you think you can use these patches in Freeswitch? Or do you think
>> you already fixed these memory leaks in a different way?
>>
>> Best Regards,
>> Jerry
>> ______________________________________________________________________
>> ___ Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>>
>>
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>
> --
> Ken
> http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.org
> irc.freenode.net #freeswitch
> Twitter: @FreeSWITCH
>
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-dev
mailing list