[asterisk-bugs] [Asterisk 0017116]: Socket leaks when SIP call is rejected

Asterisk Bug Tracker noreply at bugs.digium.com
Wed Jul 21 12:23:34 CDT 2010


The following issue has been UPDATED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17116 
====================================================================== 
Reported By:                Jiri Uncovsky
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   17116
Category:                   Channels/chan_sip/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Asterisk Version:           1.6.1.18 
JIRA:                       SWP-1189 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             2010-03-30 08:18 CDT
Last Modified:              2010-07-21 12:23 CDT
====================================================================== 
Summary:                    Socket leaks when SIP call is rejected
Description: 
When an incoming SIP call is rejected by callee, two sockets are not freed.

Output of the "core show fd" command before the call:
     3         utils.c:1865    (ast_utils_init           ): 
open("/dev/urandom",0)
     4      asterisk.c:1135    (ast_makesocket           ): 
socket(PF_UNIX,SOCK_STREAM,"tcp")
     5        logger.c:305     (make_logchannel          ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/messages","a")
     6        logger.c:1026    (init_logger              ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/event_log","a")
     7        logger.c:1038    (init_logger              ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/queue_log","a")
    10      chan_sip.c:24030   (reload_config            ): 
socket(PF_INET,SOCK_DGRAM,"udp")
    11  chan_unistim.c:5483    (reload_config            ): 
socket(PF_INET,SOCK_DGRAM,"udp")
    12 res_timing_pthread.c:120     (pthread_timer_open       ):
pipe({12,13})
    13 res_timing_pthread.c:120     (pthread_timer_open       ):
pipe({12,13})
    14       netsock.c:113     (ast_netsock_bindaddr     ): 
socket(PF_INET,SOCK_DGRAM,"udp")
    15      asterisk.c:3503    (main                     ): pipe({15,16})
    16      asterisk.c:3503    (main                     ): pipe({15,16})
    17         astmm.c:497     (__ast_mm_init            ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/mmlog","a+")

The number of opened files (got by the 'ls /proc/<pid>/fd/' command) is
18.

Output of the "core show fd" command immediately after the call and 60 
minutes after the call:

     3         utils.c:1865    (ast_utils_init           ): 
open("/dev/urandom",0)
     4      asterisk.c:1135    (ast_makesocket           ): 
socket(PF_UNIX,SOCK_STREAM,"tcp")
     5        logger.c:305     (make_logchannel          ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/messages","a")
     6        logger.c:1026    (init_logger              ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/event_log","a")
     7        logger.c:1038    (init_logger              ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/queue_log","a")
    10      chan_sip.c:24030   (reload_config            ): 
socket(PF_INET,SOCK_DGRAM,"udp")
    11  chan_unistim.c:5483    (reload_config            ): 
socket(PF_INET,SOCK_DGRAM,"udp")
    12 res_timing_pthread.c:120     (pthread_timer_open       ):
pipe({12,13})
    13 res_timing_pthread.c:120     (pthread_timer_open       ):
pipe({12,13})
    14       netsock.c:113     (ast_netsock_bindaddr     ): 
socket(PF_INET,SOCK_DGRAM,"udp")
    15      asterisk.c:3503    (main                     ): pipe({15,16})
    16      asterisk.c:3503    (main                     ): pipe({15,16})
    17         astmm.c:497     (__ast_mm_init            ): 
fopen("/opt/asterisk-1.6.1.18/var/log/asterisk/mmlog","a+")
    18           rtp.c:2434    (rtp_socket               ): 
socket(PF_INET,SOCK_DGRAM,"udp")
    19           rtp.c:2434    (rtp_socket               ): 
socket(PF_INET,SOCK_DGRAM,"udp")

The number of opened files (got by the 'ls /proc/<pid>/fd/' command) is
20.
The items 3 to 17 are identical with the output above, the items 18 a 19 
are new.

I tested this problem on Asterisk 1.6.1.18 on Debian/Lenny and I added the

following lines into extension.conf:

exten => _2001,1,Wait(1)
exten => _2001,n,Hangup()

I did no other modifications to the default configuration.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-07-21 12:23 lmadsen        Status                   feedback => closed  
2010-07-21 12:23 lmadsen        Resolution               open => fixed       
======================================================================




More information about the asterisk-bugs mailing list