[Home]

Summary:ASTERISK-15893: Socket leaks when SIP call is rejected
Reporter:jiri uncovsky (jiri uncovsky)Labels:
Date Opened:2010-03-30 08:18:09Date Closed:2010-07-21 12:23:34
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
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.
Comments:By: Leif Madsen (lmadsen) 2010-07-21 12:23:23

Looks like you're using res_timing_pthread here -- that is likely the cause of your issues.

Please re-test after this revision which fixes res_timing_pthread:

http://svn.digium.com/view/asterisk?view=rev&revision=278465

I'm going to close this issue. Please open a new issue if you continue to have this problem.