[Home]

Summary:ASTERISK-23769: critical crash in chan_unistim ?
Reporter:Tamás Németh (nice0051)Labels:
Date Opened:2014-05-21 05:28:14Date Closed:
Priority:CriticalRegression?
Status:Waiting for Feedback/In ProgressComponents:Channels/chan_unistim
Versions:11.9.0 13.18.4 Frequency of
Occurrence
Related
Issues:
Environment:LinuxAttachments:( 0) add_extension.diff
( 1) config.log
( 2) dont_optimize.txt
( 3) dont_optimize2.txt
( 4) dont_optimize3.txt
( 5) unistim_debug-and-gdb_bt_full.txt
Description: Sorry I'm not a debugging expert, so the information provided by me might be insufficient.

I observed that asterisk sometimes crashes upon powering up unistim phones.

This is what I saw in "asterisk -R" with "unistim set debug on":

Received a packet from an unknown source
Discovery packet received - Sending Discovery ACK
Creating a new entry for the phone from 172.23.60.150 received via server ip 172.23.60.150
Request received
Request received
ResumeConnectionWithServer received
Sending packet_send_query_mac_address
Request received
MAC Address received: 001969845fff
Trying to register extension '703' into context 'belfold' to USTM/703@703
asterix*CLI>
Disconnected from Asterisk server



And this is what I could collect with gdb:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff9e96c700 (LWP 3793)]
__strcmp_ssse3 () at ../sysdeps/x86_64/strcmp.S:210
210     ../sysdeps/x86_64/strcmp.S: No such file or directory.
(gdb) backtrace
#0  __strcmp_ssse3 () at ../sysdeps/x86_64/strcmp.S:210
#1  0x0000000000532cb7 in hashtab_compare_extens ()
#2  0x00000000004fa09a in ast_hashtab_lookup ()
#3  0x0000000000545446 in ast_add_extension2_lockopt.constprop.43 ()
#4  0x000000000054aaa1 in ast_add_extension ()
#5  0x00007fffb9d94567 in rcv_mac_addr () from /usr/lib64/asterisk/modules/chan_unistim.so
#6  0x00007fffb9da3792 in parsing () from /usr/lib64/asterisk/modules/chan_unistim.so
#7  0x00007fffb9da531a in unistimsock_read () from /usr/lib64/asterisk/modules/chan_unistim.so
#8  0x00000000005032ca in ast_io_wait ()
#9  0x00007fffb9d9d2ac in do_monitor () from /usr/lib64/asterisk/modules/chan_unistim.so
#10 0x000000000059580a in dummy_start ()
#11 0x00007ffff649e0db in start_thread (arg=0x7fff9e96c700) at pthread_create.c:309
#12 0x00007ffff791290d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) quit
Comments:By: Igor Goncharovsky (igorg) 2014-05-21 05:32:26.159-0500

Can you attach also configuration for phone 703 and output for gdb 'bt full'?

By: Tamás Németh (nice0051) 2014-05-21 05:41:32.214-0500

This is the phone's config:

[703]
device=001969845fff
rtp_method=1
dateformat=0
timeformat=2
ringstyle=0
context=belfold
country=hu
height=1
extension=line
maintext0="NYME Asterisk 703"
callerid="Nemeth Tamas" <703>
line => 703


Sadly I exited from gdb but I will try to crash and debug Asterisk again.

By: Tamás Németh (nice0051) 2014-05-21 06:14:17.229-0500

debug output

By: Rusty Newton (rnewton) 2014-05-22 06:39:31.580-0500

It might help to grab a backtrace while compiled with BETTER_BACKTRACES and DONT_OPTIMIZE. [See wiki instructions here|https://wiki.asterisk.org/wiki/display/AST/Getting+a+Backtrace#GettingaBacktrace-PreparingAsteriskToProduceCoreFilesOnCrash].

By: Tamás Németh (nice0051) 2014-05-30 07:33:00.037-0500

Well, I tried to enable BETTER_BACKTRACES but I didn't succeed. Make menuselect shows this option marked with 'XXX', so I cannot check it :-( See the attached file, config.log. I don't understand why I can't enable it, since binutils-devel is enabled:

# rpm -ql binutils-devel
/usr/include/ansidecl.h
/usr/include/bfd.h
/usr/include/bfdlink.h
/usr/include/demangle.h
/usr/include/dis-asm.h
/usr/include/dyn-string.h
/usr/include/fibheap.h
/usr/include/floatformat.h
/usr/include/hashtab.h
/usr/include/libiberty.h
/usr/include/objalloc.h
/usr/include/partition.h
/usr/include/plugin-api.h
/usr/include/safe-ctype.h
/usr/include/sort.h
/usr/include/splay-tree.h
/usr/include/symcat.h
/usr/include/timeval-utils.h
/usr/lib64/libbfd.a
/usr/lib64/libiberty.a
/usr/lib64/libopcodes.a

By: Tamás Németh (nice0051) 2014-05-30 09:10:44.856-0500

Anyway, here's a backtrace from an Asterisk process built with the DONT_OPTIMIZE option.

By: Tamás Németh (nice0051) 2014-05-30 10:01:06.472-0500

Another crash backtrace with this debug output:

Request received
Received a packet from an unknown source
Discovery packet received - Sending Discovery ACK
Creating a new entry for the phone from 172.23.60.160 received via server ip 172.23.60.160
Discovery packet received - Sending Discovery ACK
Request received
ResumeConnectionWithServer received
Sending packet_send_query_mac_address
Request received
[May 30 16:46:59] NOTICE[28592]: chan_unistim.c:4607 parsing: 172.23.60.160 Warning : received a retransmitted packet : #0x0000 (we are at #0x0001)
Request received
MAC Address received: 001969845fff
Trying to register extension '703' into context 'belfold' to USTM/703@703
asterix*CLI>
Disconnected from Asterisk server

By: Igor Goncharovsky (igorg) 2014-08-07 01:24:32.870-0500

Please try patch attached

By: Tamás Németh (nice0051) 2014-08-08 07:13:40.071-0500

OK, I added the patch to asterisk 11.11.0, but it still crashes. The crah may happen however at a different point, since the last few lines of unistim debug are different:

Received a packet from an unknown source
Discovery packet received - Sending Discovery ACK
Creating a new entry for the phone from 172.23.60.220 received via server ip 172.23.60.220
Discovery packet received - Sending Discovery ACK
Request received
ResumeConnectionWithServer received
Sending packet_send_query_mac_address
Request received
[Aug  8 13:55:08] NOTICE[1430]: chan_unistim.c:4604 parsing: 172.23.60.220 Warning : received a retransmitted packet : #0x0000 (we are at #0x0001)
Request received
MAC Address received: 001969845fff
asterix*CLI>





The last line is missing! It was like this:

"Trying to register extension '703' into context 'belfold' to USTM/703@703"

By: Tamás Németh (nice0051) 2014-08-08 09:33:36.560-0500

A third unistim debug and bt full output.

Just to remember myself, that's how I made it:

1. Upgraded everything
2. Removed asterisk sources from /usr/src/packages
3. zypper source-install asterisk
4. Copyed the patch to /usr/src/packages/SOURCES/add_extension.diff
5. Changed the version in /usr/src/packages/SPECS/asterisk.spec
6. Added the patch in /usr/src/packages/SPECS/asterisk.spec with these lines:
Patch4:         add_extension.diff
%patch -P 4 -p0
7. Enabled DONT_OPTIMIZE in /usr/src/packages/SPECS/asterisk.spec by changing this line:
menuselect/menuselect --enable chan_ooh323
to this:
menuselect/menuselect --enable chan_ooh323 DONT_OPTIMIZE
8. rpmbuild -bb /usr/src/packages/SPECS/asterisk.spec
9. Replaced asterisk with the newly built version
10. gdb /usr/sbin/asterisk
11. (gdb) run /usr/sbin/asterisk -fn
12. Crashing asterisk
13. (gdb) bt full

By: Igor Goncharovsky (igorg) 2019-08-28 00:17:47.334-0500

I am not able to reproduce this issue, also several issues, that could cause crash fixed since time of issue reported. Please confirm in case issue still reproduced on latest asterisk versions.