Segmentation fault (core dumped)

Hi,

I’ve installed Asterisk 1.6.0.9 on FreeBSD 7.2, successfully.
But when i tried to run the application i’ve got “Segmentation fault (core dumped)”.

it’s the log:

[code]# asterisk -cvvvvv
Asterisk 1.6.0.9, Copyright © 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for detail
s.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

== Parsing ‘/usr/local/etc/asterisk/asterisk.conf’: == Found
== Parsing ‘/usr/local/etc/asterisk/extconfig.conf’: == Found
== Parsing ‘/usr/local/etc/asterisk/logger.conf’: == Found
Asterisk Event Logger Started /var/log/asterisk/event_log
Asterisk Dynamic Loader Starting:
== Parsing ‘/usr/local/etc/asterisk/modules.conf’: == Found
[Jul 1 19:25:22] NOTICE[1427]: loader.c:869 load_modules: 1 modules will be loa
ded.
== Registered custom function ‘FIELDQTY’
== Registered custom function ‘FILTER’
== Registered custom function ‘REGEX’
== Registered custom function ‘ARRAY’
== Registered custom function ‘QUOTE’
== Registered custom function ‘LEN’
== Registered custom function ‘STRFTIME’
== Registered custom function ‘STRPTIME’
== Registered custom function ‘EVAL’
== Registered custom function ‘KEYPADHASH’
== Registered custom function ‘SPRINTF’
== Registered custom function ‘HASHKEYS’
== Registered custom function ‘HASH’
== Registered application ‘ClearHash’
== Registered custom function ‘TOUPPER’
== Registered custom function 'TOLOWER’
func_strings.so => (String handling dialplan functions)
== Parsing ‘/usr/local/etc/asterisk/dnsmgr.conf’: == Found
== Parsing ‘/usr/local/etc/asterisk/http.conf’: == Found
== Manager registered action Ping
== Manager registered action Events
== Manager registered action Logoff
== Manager registered action Login
== Manager registered action Challenge
== Manager registered action Hangup
== Manager registered action Status
== Manager registered action Setvar
== Manager registered action Getvar
== Manager registered action GetConfig
== Manager registered action GetConfigJSON
== Manager registered action UpdateConfig
== Manager registered action CreateConfig
== Manager registered action ListCategories
== Manager registered action Redirect
== Manager registered action Originate
== Manager registered action Command
== Manager registered action ExtensionState
== Manager registered action AbsoluteTimeout
== Manager registered action MailboxStatus
== Manager registered action MailboxCount
== Manager registered action ListCommands
== Manager registered action SendText
== Manager registered action UserEvent
== Manager registered action WaitEvent
== Manager registered action CoreSettings
== Manager registered action CoreStatus
== Manager registered action Reload
== Manager registered action CoreShowChannels
== Manager registered action ModuleLoad
== Manager registered action ModuleCheck
== Parsing ‘/usr/local/etc/asterisk/manager.conf’: == Found
== Parsing ‘/usr/local/etc/asterisk/users.conf’: == Found
== Parsing ‘/usr/local/etc/asterisk/cdr.conf’: == Found
[Jul 1 19:25:22] NOTICE[1427]: cdr.c:1430 do_reload: CDR simple logging enabled
.
== Parsing ‘/usr/local/etc/asterisk/rtp.conf’: == Found
== RTP Allocating from port range 10000 -> 20000
== Parsing ‘/usr/local/etc/asterisk/udptl.conf’: == Found
== UDPTL allocating from port range 4000 -> 4999
Asterisk PBX Core Initializing
Registering builtin applications:
== Registered custom function ‘EXCEPTION’
[Answer]
== Registered application ‘Answer’
[BackGround]
== Registered application ‘BackGround’
[Busy]
== Registered application ‘Busy’
[Congestion]
== Registered application ‘Congestion’
[ExecIfTime]
== Registered application ‘ExecIfTime’
[Goto]
== Registered application ‘Goto’
[GotoIf]
== Registered application ‘GotoIf’
[GotoIfTime]
== Registered application ‘GotoIfTime’
[ImportVar]
== Registered application ‘ImportVar’
[Hangup]
== Registered application ‘Hangup’
[NoOp]
== Registered application ‘NoOp’
[Proceeding]
== Registered application ‘Proceeding’
[Progress]
== Registered application ‘Progress’
[RaiseException]
== Registered application ‘RaiseException’
[ResetCDR]
== Registered application ‘ResetCDR’
[Ringing]
== Registered application ‘Ringing’
[SayAlpha]
== Registered application ‘SayAlpha’
[SayDigits]
== Registered application ‘SayDigits’
[SayNumber]
== Registered application ‘SayNumber’
[SayPhonetic]
== Registered application ‘SayPhonetic’
[Set]
== Registered application ‘Set’
[MSet]
== Registered application ‘MSet’
[SetAMAFlags]
== Registered application ‘SetAMAFlags’
[Wait]
== Registered application ‘Wait’
[WaitExten]
== Registered application ‘WaitExten’
== Manager registered action ShowDialPlan
== Registered application ‘Bridge’
== Parsing ‘/usr/local/etc/asterisk/features.conf’: == Found
– Registered extension context ‘parkedcalls’ (0x34205e80) in table 0x342079
a0; registrar: features
– Added extension ‘700’ priority 1 to parkedcalls (0x34205e80)
== Registered application ‘ParkedCall’
== Registered application ‘Park’
== Manager registered action ParkedCalls
== Manager registered action Park
== Manager registered action Bridge
[Jul 1 19:25:22] WARNING[1427]: db.c:57 dbinit: Unable to open Asterisk databas
e ‘/var/db/asterisk/astdb’: No such file or directory
== Manager registered action DBGet
== Manager registered action DBPut
== Manager registered action DBDel
== Manager registered action DBDelTree
== Parsing ‘/usr/local/etc/asterisk/enum.conf’: == Found
Asterisk Dynamic Loader Starting:
== Parsing ‘/usr/local/etc/asterisk/modules.conf’: == Found
[Jul 1 19:25:22] NOTICE[1427]: loader.c:869 load_modules: 167 modules will be l
oaded.
Segmentation fault (core dumped)
[/code]

Please help me,
Regards

Follow the procedures in doc/backtrace.txt and then submit the result to issues.asterisk.org.

If you are concerned that you have a configuration error, first post just the lines around where gdb reports the segmentation fault and the output from the basic bt command, here.

The most likely configuration error is failing to remove old modules properly when installing a new version.

I suppose - you did:
./configure
make menuconfig
make
make install
If so - then look how to get info from dump files. Even in this forum there were such posts. I did it once but fully forgot …

1 Like

When you do the “make install”, it actually tells you if there are any modules there that it didn’t put there. If there are, you should almost certainly delete them, although most people never read the message.

I have run into a very similar error. I recently installed asterisk 1.6.0.9 (asterisk16-1.6.0.9_1, compiled from ports) with FreeBSD 7.2-RELEASE on a Soekris Net 5501. I see the following:

soekris3# asterisk -c
Asterisk 1.6.0.9, Copyright © 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer markster@digium.com
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

[ Booting…
[ Reading Master Configuration ]
[ Initializing Custom Configuration Options ]
[Jul 29 22:08:08] NOTICE[1269]: loader.c:869 load_modules: 1 modules will be loaded.
.[Jul 29 22:08:08] NOTICE[1269]: cdr.c:1430 do_reload: CDR simple logging enabled.
[Jul 29 22:08:08] NOTICE[1269]: loader.c:869 load_modules: 165 modules will be loaded.
…[Jul 29 22:08:09] NOTICE[1269]: res_smdi.c:1272 load_module: No SMDI interfaces are available to listen on, not starting SMDI listener.
…Segmentation fault (core dumped)

soekris3# gdb /usr/local/sbin/asterisk asterisk.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “i386-marcel-freebsd”…(no debugging symbols found)…
Core was generated by `asterisk’.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libssl.so.5…(no debugging symbols found)…done.
Loaded symbols for /usr/lib/libssl.so.5
Reading symbols from /lib/libcrypto.so.5…(no debugging symbols found)…done.
Loaded symbols for /lib/libcrypto.so.5
Reading symbols from /lib/libncurses.so.7…(no debugging symbols found)…done.
Loaded symbols for /lib/libncurses.so.7
Reading symbols from /usr/lib/libstdc++.so.6…(no debugging symbols found)…done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/libm.so.5…(no debugging symbols found)…done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libgcc_s.so.1…(no debugging symbols found)…done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libthr.so.3…(no debugging symbols found)…done.
Loaded symbols for /lib/libthr.so.3
Reading symbols from /lib/libc.so.7…(no debugging symbols found)…done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /usr/local/lib/asterisk/modules/func_strings.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/func_strings.so
Reading symbols from /usr/local/lib/asterisk/modules/res_ael_share.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_ael_share.so
Reading symbols from /usr/local/lib/asterisk/modules/res_phoneprov.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_phoneprov.so
Reading symbols from /usr/local/lib/asterisk/modules/res_agi.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_agi.so
Reading symbols from /usr/local/lib/asterisk/modules/res_indications.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_indications.so
Reading symbols from /usr/local/lib/asterisk/modules/res_jabber.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_jabber.so
Reading symbols from /usr/local/lib/libiksemel.so.4…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libiksemel.so.4
Reading symbols from /usr/local/lib/libgnutls.so.26…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libgnutls.so.26
Reading symbols from /usr/local/lib/libgcrypt.so.16…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libgcrypt.so.16
Reading symbols from /usr/local/lib/libgpg-error.so.0…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libgpg-error.so.0
Reading symbols from /lib/libz.so.4…(no debugging symbols found)…done.
Loaded symbols for /lib/libz.so.4
Reading symbols from /usr/local/lib/libintl.so.8…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libintl.so.8
Reading symbols from /usr/local/lib/libiconv.so.3…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /usr/local/lib/asterisk/modules/res_monitor.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_monitor.so
Reading symbols from /usr/local/lib/asterisk/modules/res_smdi.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_smdi.so
Reading symbols from /usr/local/lib/asterisk/modules/res_snmp.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_snmp.so
Reading symbols from /usr/local/lib/libnetsnmpagent.so.16…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libnetsnmpagent.so.16
Reading symbols from /usr/local/lib/libnetsnmphelpers.so.16…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libnetsnmphelpers.so.16
Reading symbols from /usr/local/lib/libnetsnmpmibs.so.16…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libnetsnmpmibs.so.16
Reading symbols from /usr/local/lib/libnetsnmp.so.16…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/libnetsnmp.so.16
Reading symbols from /usr/lib/libelf.so.1…(no debugging symbols found)…done.
Loaded symbols for /usr/lib/libelf.so.1
Reading symbols from /lib/libkvm.so.4…(no debugging symbols found)…done.
Loaded symbols for /lib/libkvm.so.4
Reading symbols from /lib/libdevstat.so.6…(no debugging symbols found)…done.
Loaded symbols for /lib/libdevstat.so.6
Reading symbols from /usr/local/lib/perl5/5.8.9/mach/CORE/libperl.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/perl5/5.8.9/mach/CORE/libperl.so
Reading symbols from /lib/libcrypt.so.4…(no debugging symbols found)…done.
Loaded symbols for /lib/libcrypt.so.4
Reading symbols from /lib/libutil.so.7…(no debugging symbols found)…done.
Loaded symbols for /lib/libutil.so.7
Reading symbols from /usr/lib/libwrap.so.5…(no debugging symbols found)…done.
Loaded symbols for /usr/lib/libwrap.so.5
Reading symbols from /usr/local/lib/asterisk/modules/res_speech.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/asterisk/modules/res_speech.so
Reading symbols from /usr/local/lib/pwlib/codecs/audio/gsm0610_audio_pwplugin.so…(no debugging symbols found)…done.
Loaded symbols for /usr/local/lib/pwlib/codecs/audio/gsm0610_audio_pwplugin.so
Reading symbols from /usr/local/lib/pwlib/codecs/audio/ilbc_audio_pwplugin.so…done.
Loaded symbols for /usr/local/lib/pwlib/codecs/audio/ilbc_audio_pwplugin.so
Reading symbols from /usr/local/lib/pwlib/codecs/audio/ima_adpcm_audio_pwplugin.so…done.
Loaded symbols for /usr/local/lib/pwlib/codecs/audio/ima_adpcm_audio_pwplugin.so
Reading symbols from /usr/local/lib/pwlib/codecs/audio/lpc10_audio_pwplugin.so…done.
Loaded symbols for /usr/local/lib/pwlib/codecs/audio/lpc10_audio_pwplugin.so
Reading symbols from /usr/local/lib/pwlib/codecs/audio/speex_audio_pwplugin.so…done.
Loaded symbols for /usr/local/lib/pwlib/codecs/audio/speex_audio_pwplugin.so
Reading symbols from /libexec/ld-elf.so.1…done.
Loaded symbols for /libexec/ld-elf.so.1
#0 0x28f32009 in ?? ()
[New Thread 0x286017b0 (LWP 100056)]
[New Thread 0x286016a0 (LWP 100055)]
[New Thread 0x28601590 (LWP 100054)]
[New Thread 0x28601480 (LWP 100053)]
[New Thread 0x28601370 (LWP 100052)]
[New Thread 0x28601260 (LWP 100051)]
[New Thread 0x28601040 (LWP 100060)]
(gdb) bt
#0 0x28f32009 in ?? ()
#1 0x28b2fa00 in ?? ()
#2 0x28642ec0 in ?? ()
#3 0xbfbfe188 in ?? ()
#4 0x28f322fd in ?? ()
#5 0x28642ec0 in ?? ()
#6 0x00000000 in ?? ()
#7 0x28faf9d0 in ?? ()
#8 0x28faf9d0 in ?? ()
#9 0x286391d0 in ?? ()
#10 0x28faf9d0 in ?? ()
#11 0xbfbfe1b8 in ?? ()
#12 0x28f646c1 in ?? ()
#13 0x28642ec0 in ?? ()
#14 0x00000000 in ?? ()
#15 0xbfbfe1d8 in ?? ()
#16 0x00000001 in ?? ()
#17 0x28600000 in ?? ()
#18 0x0816a5c0 in ?? ()
#19 0x0816a6f0 in ?? ()
#20 0x28faf9d0 in ?? ()
#21 0x286130d8 in ?? ()
#22 0x0000000c in ?? ()
—Type to continue, or q to quit—
#23 0xbfbfe1d8 in ?? ()
#24 0x28f630d0 in ?? ()
#25 0x28faf9d0 in ?? ()
#26 0x00000000 in ?? ()
#27 0xbfbfe1f8 in ?? ()
#28 0x2847e1d6 in pthread_mutex_destroy () from /lib/libthr.so.3
Previous frame inner to this frame (corrupt stack?)
(gdb)


Regarding my config, I am using the sample .conf files provided with the port, except I added the following lines to modules.conf to eliminate a few errors:
noload => res_config_ldap.so
noload => res_config_sqlite.so

Any idea how I can get asterisk to run without crashing? Thanks in advance!

You probably have memory corruption, in which case you need to read docs/valgrind.txt.

However, you haven’t followed the instructions to in backtrace.txt. specifically the one about producing an unoptimised build, so even if there is no memory corruption, this backtrace is not really useful.

Also double check that you do not have any modules from a different version, in your /usr/lib/asterisk/modules directory.

Reading symbols from /usr/local/lib/asterisk/modules/func_strings.so...(no debugging symbols found)...done. Loaded symbols for /usr/local/lib/asterisk/modules/func_strings.so

Note where it says “no debugging symbols found”.

OK, I see that the dump is not very helpful as I have produced it. I can’t find the docs/valgrind.txt on my system, but I did find the following via google:

voip-info.org/wiki/view/Aste … lgrind.txt

Please let me know if this is the diagnostic procedure you are referring to. I am in the process of building valgrind from ports on my system in preparation of doing the analysis. Also, regarding your comment about a “memory corruption”, I am getting the same error when running under VMWare on my deployment laptop as I am on the embedded platform. I use my VMWare image to compile the ports, then I use pkg_add to install them as packages on the appliance, so the build is exactly the same. What I’m saying is that I don’t beleive the problem is hardware related. In addition, using a 2nd VM, I installed the asterisk 1.4.25 port and it worked fine.

doc not docs:

http://svn.digium.com/svn/asterisk/tags/1.6.0.9/doc/valgrind.txt

but it will be the same.

Backtrace is:

http://svn.digium.com/svn/asterisk/tags/1.6.0.9/doc/backtrace.txt

OK, I’m stuck on this one. When I issue the “make config” command in FreeBSD, I don’t see any options to turn on debugging or disable optimizations. I have seen options like this with other ports, but not for asterisk16 (or the 1.4 version of the port either). I know that menuselect is that way these options are controlled in Linux, but I have no idea how to produce the same results when building under FreeBSD, e.g., I tried using “menuselect” and even “make menuselect” in the port’s directory, without any positive results.

Any suggestions here?

I was getting the exact same problem here on FreeBSD v7.2 after installing net/asterisk16 from the ports collection :
http://www.freshports.org/net/asterisk16/

I eventually fixed the problem, by running “make config” in the net/asterisk16 port directory, and deselecting the majority of the options being compiled in there.

The only ones I left enabled in the “make config” menu were :

JABBER (Enable Jabber and Gtalk support)
GSM (Enable GSM codec)
CURL (Enable CURL support)

With only these three options enabled, after de-installing the existing version of asterisk and re-running “make install”, asterisk would actually fire up without the core dump happening, and has been running fine here ever since. I have no need for any of the other ones I de-selected, and only need CURL and Jabber support for some hacking I want to do on personal projects down the road.

Looks like the problem is in one of the options I deselected there!