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

Matthias Urlichs (JIRA) noreply at issues.asterisk.org
Sun Feb 22 09:23:34 CST 2015


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

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

To debug this with gdb, you basically attach it to Asterisk, set a breakpoint on the pipe() and pipe2() syscalls with "catch syscall pipe", use "where" to get a stack trace. You now see where the pipe gets allocated. Find the code that's responsible for cleaning up that allocation. Also, set a break on __ao2_ref to find any code which increments or decrements the reference count of the object where the pipe's file descriptor numbers are stored. You'll probably find an increment that's not balanced by a decrement. Fix it.

As an example, examine the previous fix. The error was that the allocator also enqueued the object, which increases the refcount; however the function which indicates that the system is done with it didn't dequeue it. Instant leak.

If that doesn't help, get the perl script at http://search.cpan.org/~infinoid/App-SVN-Bisect-1.0/bin/svn-bisect, find an older Asterisk version that doesn't have the bug, and use that svn-bisect script to find the the patch which introduced the problem. Most likely that'll point to a solution.

> 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
>         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