[Home]

Summary:ASTERISK-24239: UDP sockets used for RTP are sometimes leaked
Reporter:Etienne Lessard (hexanol)Labels:
Date Opened:2014-08-15 10:16:27Date Closed:2014-08-28 08:03:45
Priority:MajorRegression?
Status:Closed/CompleteComponents:
Versions:11.9.0 11.11.0 Frequency of
Occurrence
Related
Issues:
Environment:Debian wheezy (7.6) 32-bitsAttachments:
Description:I found on 2 different asterisk (11.9.0 and 11.11.0 respectively) that UDP sockets bound in the RTP range were left open, and that the res_rtp_asterisk module had a high use count.

On the first asterisk process, there was ~1625 UDP sockets bound in the RTP range and the res_rtp_asterisk use count was 811. On the second, there was 12 UDP sockets bound in the RTP range, and the res_rtp_asterisk use count was 6.

In both case, there was no active channels (core show channels returned nothing) and there was no recent activity (i.e. no new calls since at least 5 minutes).

Excerpt of lsof output for the asterisk process:
{noformat}
udp        0      0 192.168.17.81:18699     0.0.0.0:*
udp        0      0 192.168.17.81:11531     0.0.0.0:*
udp        0      0 192.168.17.81:19211     0.0.0.0:*
udp        0      0 192.168.17.81:15627     0.0.0.0:*
....
{noformat}

I've tried to reproduce the problem but I've not yet been able. I've seen that at least one other person had a similar problem: http://forums.asterisk.org/viewtopic.php?f=1&t=82000

I found this problem while I was looking for a sound problem. On the machine with 811 "leaked" UDP sockets, they had the week earlier a sound problem where A call B, B answer, A could hear B but B could NOT hear A. When that problem happened, an asterisk restart was needed for the calls to once again worked reliably. I did not found any particular errors/warnings in the logs just before the restart.

I'll update the ticket if I find a way on how to systematically reproduce it.
Comments:By: Etienne Lessard (hexanol) 2014-08-15 10:21:25.059-0500

I've just taken a more careful looked at the lsof output, after sorting it, and we can see that the UDP sockets are always leaked in pair, i.e. one bound on port N and one on port N+1, so I guess it's both the RTP and RTCP sockets that are leaked, and that the "number of sockets leaked" = 2 * "res_rtp_asterisk" use count.

By: Matt Jordan (mjordan) 2014-08-17 17:53:26.250-0500

Compile Asterisk with {{DEBUG_FD_LEAKS}}. That will give you the CLI command "core show fd", which will show who allocated the ports. That will help narrow down how the file descriptors are leaking.

By: Etienne Lessard (hexanol) 2014-08-21 09:11:23.851-0500

Ok, we've put in place a version of asterisk 11.11.0 compiled with DEBUG_FD_LEAKS, I'll attach the output of "core show fd" once the problem shows up.

By: Etienne Lessard (hexanol) 2014-08-27 14:32:23.381-0500

Well, I got some results and did some analysis... and found out this was actually due to a module that is not part of the asterisk code.

So this ticket can be rejected. I'm sorry for the noise and lost of time due to it. I'll be more careful next time.

By: Matt Jordan (mjordan) 2014-08-28 08:03:45.051-0500

No worries. Hope you got the other module fixed :-)