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

Matthias Urlichs (JIRA) noreply at issues.asterisk.org
Sun Feb 8 11:11:34 CST 2015


     [ https://issues.asterisk.org/jira/browse/ASTERISK-24768?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthias Urlichs updated ASTERISK-24768:
----------------------------------------

    Description: 
Pthread timers are never deallocated. 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
{code}
    diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c
    index 81efbf8..d88e5f7 100644
    --- a/res/res_timing_pthread.c
    +++ b/res/res_timing_pthread.c
    @@ -153,6 +153,12 @@ static void pthread_timer_close(void *data)
     {
            struct pthread_timer *timer = data;
     
    +       ao2_lock(pthread_timers);
    +       ast_mutex_lock(&timing_thread.lock);
    +       ao2_unlink(pthread_timers, timer);
    +       ast_mutex_unlock(&timing_thread.lock);
    +       ao2_unlock(pthread_timers);
    +
            ao2_ref(timer, -1);
     }
 {code}

  was:
Pthread timers are never deallocated. 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

    diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c
    index 81efbf8..d88e5f7 100644
    --- a/res/res_timing_pthread.c
    +++ b/res/res_timing_pthread.c
    @@ -153,6 +153,12 @@ static void pthread_timer_close(void *data)
     {
            struct pthread_timer *timer = data;
     
    +       ao2_lock(pthread_timers);
    +       ast_mutex_lock(&timing_thread.lock);
    +       ao2_unlink(pthread_timers, timer);
    +       ast_mutex_unlock(&timing_thread.lock);
    +       ao2_unlock(pthread_timers);
    +
            ao2_ref(timer, -1);
     }
 




> 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
>
> Pthread timers are never deallocated. 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
> {code}
>     diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c
>     index 81efbf8..d88e5f7 100644
>     --- a/res/res_timing_pthread.c
>     +++ b/res/res_timing_pthread.c
>     @@ -153,6 +153,12 @@ static void pthread_timer_close(void *data)
>      {
>             struct pthread_timer *timer = data;
>      
>     +       ao2_lock(pthread_timers);
>     +       ast_mutex_lock(&timing_thread.lock);
>     +       ao2_unlink(pthread_timers, timer);
>     +       ast_mutex_unlock(&timing_thread.lock);
>     +       ao2_unlock(pthread_timers);
>     +
>             ao2_ref(timer, -1);
>      }
>  {code}



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



More information about the asterisk-bugs mailing list