[asterisk-bugs] [JIRA] (ASTERISK-24768) res_timing_pthread: file descriptor leak

Matthias Urlichs (JIRA) noreply at issues.asterisk.org
Thu Aug 18 02:36:56 CDT 2016


    [ https://issues.asterisk.org/jira/browse/ASTERISK-24768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=231872#comment-231872 ] 

Matthias Urlichs commented on ASTERISK-24768:
---------------------------------------------

>> lsof -p $(pidof asterisk) | grep asterisk | wc -l 
The "grep" part is superfluous. Also, you want "pidof -s" in case Asterisk is busy forking an external process. In this case, you'd use "cat /run/asterisk/asterisk.pid" instead, because that's where you *know* the process ID is, instead of searching the whole system for it.

>> lsof | grep asterisk | wc -l 
Do you know what a thread is? Asterisk has a lot of them. They share file descriptors (not necessarily, which is why "lsof" examines them in the first place, but in Asterisk's case they do). You want to count these once, not 64 times.

In any case, "lsof" does way too much work if all you need to know is the number of open file descriptors. Do
>> ls -f1 /proc/$(cat /run/asterisk/asterisk.pid)/fd | wc -l
for that.


> res_timing_pthread: file descriptor leak
> ----------------------------------------
>
>                 Key: ASTERISK-24768
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24768
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Resources/res_timing_pthread
>    Affects Versions: 13.2.0
>         Environment: Current Debian (jessie/testing), i386, up-to-date
>            Reporter: Matthias Urlichs
>            Assignee: Joshua Colp
>      Target Release: 13.3.0, 14.0.0
>
>         Attachments: timer.patch
>
>
> Pthread timers are never deallocated because their link into the pthread_timers chain is never undone.
> This causes a file descriptor leak (at least two per incoming call).
> The locking in this patch probably needs review; the ao2_unlink() call does not. :-P
> \[Edit:\] *Inline patch removed*



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list