[Home]

Summary:ASTERISK-25022: Memory leak setting up DTLS/SRTP calls
Reporter:Steve Davies (one47)Labels:
Date Opened:2015-04-28 04:43:49Date Closed:2015-04-28 10:32:40
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/RTP Resources/res_rtp_asterisk
Versions:11.17.1 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Load testing using JsSIP over WebSocketsAttachments:
Description:Load testing of inbound call over WebSockets using JsSIP, routed out over a regular SIP call. Calls started at 0.5s intervals and allowed to run for 10s.

After a period of time, a memory leak was apparent. Using DEBUG_ALLOC and REF_DEBUG found the following issues:

==== Leaked Object 0xb2820c54 history ====
[22433] res_srtp.c:240 ast_srtp_policy_alloc: +1 Allocating policy - [**constructor**]
[22433] res_srtp.c:516 ast_srtp_add_stream: +1 Added additional stream - [1]
[22078] res_srtp.c:480 ast_srtp_destroy: -1 Unallocate policy - [2]


--
==== Leaked Object 0xb31868fc history ====
[22449] res_srtp.c:240 ast_srtp_policy_alloc: +1 Allocating policy - [**constructor**]
[22449] res_srtp.c:461 ast_srtp_create: +1 Created initial policy - [1]
[22078] res_srtp.c:480 ast_srtp_destroy: -1 Unallocate policy - [2]


And using 'uniq -c' on memory allocations output the following entries were never free'd:
  1126         31 bytes allocated by ast_rtp_dtls_cfg_copy() line  2295 of rtp_engine.c
  1126         33 bytes allocated by ast_rtp_dtls_cfg_copy() line  2296 of rtp_engine.c
  1126          8 bytes allocated by ast_rtp_dtls_cfg_copy() line  2297 of rtp_engine.c


Comments:By: Steve Davies (one47) 2015-04-28 05:08:23.924-0500

I have a proposed patch for this which I'll submit to Gerrit. (Assuming I can work out how!)

By: Steve Davies (one47) 2015-04-28 05:43:00.529-0500

https://gerrit.asterisk.org/#/c/268/

I hope I did that right!

By: Joshua C. Colp (jcolp) 2015-04-28 05:52:16.650-0500

Not quite. It looks like you submitted a draft review. Until it's been published it isn't viewable by others. Since it's a bug fix you'll also want to either cherry pick the fix into the relevant branches now, or wait until later. Documentation on that is at https://wiki.asterisk.org/wiki/display/AST/Gerrit+Usage#GerritUsage-BranchCherry-Picking

By: Steve Davies (one47) 2015-04-28 06:05:22.035-0500

Thanks for the pointer. Does it look right now?

https://gerrit.asterisk.org/#/c/268/
https://gerrit.asterisk.org/#/c/269/
https://gerrit.asterisk.org/#/c/270/

Cheers,
Steve

By: Joshua C. Colp (jcolp) 2015-04-28 06:13:15.666-0500

Yup! Already reviewed even.