[asterisk-bugs] [Asterisk 0012346]: null pointer in chan_skinny when 'regcontext' used

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Apr 10 07:56:08 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=12346 
====================================================================== 
Reported By:                candlerb
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12346
Category:                   Core/PBX
Reproducibility:            always
Severity:                   crash
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.0 
SVN Revision (number only!): 111962 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             04-01-2008 03:57 CDT
Last Modified:              04-10-2008 07:56 CDT
====================================================================== 
Summary:                    null pointer in chan_skinny when 'regcontext' used
Description: 
Uncomment the 'regcontext' example line from skinny.conf, wait for a Cisco
phone to connect, and Asterisk dumps core.

GDB output:

...
[New Thread -1215501408 (LWP 12516)]
    -- Starting Skinny session from 10.69.255.249
    -- Added extension '110' priority 1 to skinnyregistrations

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1215501408 (LWP 12516)]
ast_add_extension2 (con=0x86d1a88, replace=1, extension=0xb78ce1c0 "110",
    priority=Variable "priority" is not available.
) at pbx.c:6056
6056                            if (x->exten) { /* this test for safety
purposes */
(gdb) bt
http://bugs.digium.com/view.php?id=0  ast_add_extension2 (con=0x86d1a88,
replace=1, extension=0xb78ce1c0
"110",
    priority=Variable "priority" is not available.
) at pbx.c:6056
http://bugs.digium.com/view.php?id=1  0x080e4f71 in ast_add_extension
(context=0x363840
"skinnyregistrations",
    replace=141620640, extension=0x870f5a0 "??p\b", priority=141620640,
    label=0x870f5a0 "??p\b", callerid=0x870f5a0 "??p\b",
    application=0x870f5a0 "??p\b", data=0x870f5a0, datad=0x870f5a0,
    registrar=0x870f5a0 "??p\b") at pbx.c:5859
http://bugs.digium.com/view.php?id=2  0x00359a6f in handle_message
(req=0x870f180, s=0x870e600)
    at
/home/candlerb/svn/asterisk/branches/1.6.0/include/asterisk/utils.h:502
http://bugs.digium.com/view.php?id=3  0x0035b88f in skinny_session
(data=0x870e600) at chan_skinny.c:5585
http://bugs.digium.com/view.php?id=4  0x08122445 in dummy_start (data=0x86d1a88)
at utils.c:870
http://bugs.digium.com/view.php?id=5  0x005793cc in start_thread () from
/lib/tls/libpthread.so.0
http://bugs.digium.com/view.php?id=6  0x004d21ae in clone () from
/lib/tls/libc.so.6
(gdb) print x
$1 = (struct match_char *) 0x0

I wondered if this was perhaps because I had no [skinnyregistrations]
section in extensions.conf, but I added one and it made no difference.

====================================================================== 

---------------------------------------------------------------------- 
 candlerb - 04-10-08 07:56  
---------------------------------------------------------------------- 
FYI I can now repeat problem 2 reliably, which appears to be related in
some way. What you do is (with keepalive=120):

1. restart asterisk
2. wait for phone to register itself (it starts a thread)
3. unplug and replug the phone (it starts another thread)
4. wait for the thread started in step (2) to terminate

The phone is now considered 'unregistered' by Asterisk, but as far as the
phone is concerned it is talking happily. Hell breaks loose when you start
pressing buttons on it, as Asterisk processes the button presses but
doesn't know where to send the replies.

[Apr 10 13:44:59] Asterisk Ready.
[New Thread -1214932064 (LWP 17584)]
*CLI> [New Thread -1215177824 (LWP 17585)]   << INITIAL REGISTRATION
[Apr 10 13:45:10]     -- Starting Skinny session from 10.69.255.249
[Apr 10 13:45:10]     -- Device 'SEP00195659657A' successfully registered
[Apr 10 13:45:10] Adding button: 9, 1
[Apr 10 13:45:10] Device capability set to '12'

*CLI> skinny show device brian
Name:        brian
Id:          SEP00195659657A
version:     P002F202
Ip address:  10.69.255.249
Port:        52528
Device Type: 7941
Registered:  Yes         <<<<<<<<< NOTE
Lines:       1
  111 (Brian Candler)
Addons:      0
Speeddials:  0
*CLI> [New Thread -1215423584 (LWP 17594)]    << SECOND REGISTRATION
[Apr 10 13:46:06]     -- Starting Skinny session from 10.69.255.249
[Apr 10 13:46:06]     -- Device 'SEP00195659657A' successfully registered
[Apr 10 13:46:06] Adding button: 9, 1
[Apr 10 13:46:06] Device capability set to '12'
skinny show device brian
Name:        brian
Id:          SEP00195659657A
version:     P002F202
Ip address:  10.69.255.249
Port:        49954
Device Type: 7941
Registered:  Yes          <<<<<<<<< NOTE
Lines:       1
  111 (Brian Candler)
Addons:      0
Speeddials:  0
*CLI> [Apr 10 13:46:44]     -- ast_get_srv: SRV lookup for
'_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
[Apr 10 13:46:44]     -- ast_get_srv: SRV lookup for
'_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
[Thread -1215177824 (LWP 17585) exited]   << INITIAL REGISTRATION
EXPIRED!
[Apr 10 13:48:29]     -- ast_get_srv: SRV lookup for
'_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
[Apr 10 13:48:29]     -- ast_get_srv: SRV lookup for
'_sip._UDP.sipgate.co.uk' mapped to host sipgate.co.uk, port 5060
skinny show device brian
Name:        brian
Id:          SEP00195659657A
version:     P002F202
Ip address:  Unknown
Port:        0
Device Type: 7941
Registered:  No            <<<<<<< NOTE!!!
Lines:       1
  111 (Brian Candler)
Addons:      0
Speeddials:  0
*CLI> [Apr 10 13:50:07] WARNING[17560]: chan_skinny.c:1557 
find_subchannel_by_instance_reference: Could not find subchannel with
reference '0' on 'brian'  << PICKED UP HERE
[New Thread -1215177824 (LWP 17595)]
[Apr 10 13:50:07]     -- Starting simple switch on '111 at brian'
[Apr 10 13:50:09] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:09] NOTICE[17560]: chan_skinny.c:3644 skinny_indicate: Asked
to indicate 'Stop tone' condition on channel Skinny/111 at brian-1, but
session does not exist.
[Apr 10 13:50:10] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:10] NOTICE[17560]: chan_skinny.c:3644 skinny_indicate: Asked
to indicate 'Stop tone' condition on channel Skinny/111 at brian-1, but
session does not exist.
[Apr 10 13:50:10] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:10] NOTICE[17560]: chan_skinny.c:3644 skinny_indicate: Asked
to indicate 'Stop tone' condition on channel Skinny/111 at brian-1, but
session does not exist.
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12]     -- Executing [611 at from-skinny:1]
Answer("Skinny/111 at brian-1", "") in new stack
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12] WARNING[17560]: chan_skinny.c:1827 transmit_response:
Asked to transmit to a non-existant session!
[Apr 10 13:50:12]     -- Executing [611 at from-skinny:2]
Playback("Skinny/111 at brian-1", "your-call-is-not-important") in new stack
[Apr 10 13:50:12]     -- <Skinny/111 at brian-1> Playing
'your-call-is-not-important.gsm' (language 'en')

The problem goes away if you set keepalive=30, because the original
connection thread terminates itself before the phone reboots:

*CLI> [New Thread -1215685728 (LWP 17630)]     << INITIAL REGISTRATION
[Apr 10 13:52:32]     -- Starting Skinny session from 10.69.255.249
[Apr 10 13:52:32]     -- Device 'SEP00195659657A' successfully registered
[Apr 10 13:52:32] Adding button: 9, 1
[Apr 10 13:52:32] Device capability set to '12'
[Thread -1215685728 (LWP 17630) exited]     << INITIAL REGISTRATION
EXPIRED
[New Thread -1215685728 (LWP 17637)]        << NEW REGISTRATION
[Apr 10 13:53:22]     -- Starting Skinny session from 10.69.255.249
[Apr 10 13:53:22]     -- Device 'SEP00195659657A' successfully registered
[Apr 10 13:53:22] Adding button: 9, 1
[Apr 10 13:53:22] Device capability set to '12'

So the problem seems to be that when a session expires the phone is
forcibly unregistered, even if the phone has in the mean time re-registered
via another session. Whether the responsibility for detecting this
condition lies with chan_skinny or core, though, I don't know. If it's
chan_skinny I'll open a new ticket.

Aside: I'm using a timeout of 120 because that's what
configs/skinny.conf.sample shows. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
04-10-08 07:56  candlerb       Note Added: 0085282                          
======================================================================




More information about the asterisk-bugs mailing list