[Home]

Summary:ASTERISK-11195: codec_resample crashes asterisk on loading ("Bus error")
Reporter:dmartin (dmartin)Labels:
Date Opened:2008-01-10 04:13:27.000-0600Date Closed:2008-01-11 13:06:08.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Codecs/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) bt.txt
Description:Loading codec_resample automatically or by console once started, crashes whole Asterisk automatically with a "Bus error" and no more debug from the application. I have to add the line "noload => codec_resample.so" to make it start. It crashes even with the default configuration on a fresh install.

I'm using latest asterisk from SVN.

What can I do to help you identifying the failure?

****** ADDITIONAL INFORMATION ******

Asterisk is running on Debian GNU/Linux(Sid) with latest 2.6 kernel from git, on a Sun Netra X1 (UltraSPARC-IIe 500MHz, 1024 MB RAM)
Comments:By: Russell Bryant (russell) 2008-01-10 18:05:36.000-0600

Well, if you could get a backtrace, that would be helpful.  I'm going to try to get on a Linux/sparc machine to test it myself, though, if i can.

Build with DONT_OPTIMIZE enabled.  Then, start Asterisk with the -g flag so it makes a core dump when it crashes.

# gdb /usr/sbin/asterisk core.12345
(gdb) bt
(gdb) bt full

By: dmartin (dmartin) 2008-01-10 18:38:35.000-0600

I've just attached the output from gdb. I didn't compile with DONT_OPTIMIZE yet, I will do if the backtrace is not enough.

Do you think that this is a linux/sparc specific issue ? Ah, didn't mention, but it crashes compiling with gcc-4.2 and gcc-4.3.

By: snuffy (snuffy) 2008-01-10 21:46:11.000-0600

dmartin with a 'bus error' it is most likely that it is a sparc thing, most likely due to 'unaligned access' of memory.

By: Digium Subversion (svnbot) 2008-01-11 12:46:00.000-0600

Repository: asterisk
Revision: 98270

U   trunk/codecs/codec_resample.c

------------------------------------------------------------------------
r98270 | russell | 2008-01-11 12:45:59 -0600 (Fri, 11 Jan 2008) | 7 lines

Fix a bus error that happened when asterisk was built with optimizations on
with platforms that explode on unaligned access.  I'm not exactly sure why
this fixes it, but it fixed it on the machine I was testing on.  If it makes
sense to you, feel free to enlighten me.  :)

(closes issue ASTERISK-11195, patched by me)

------------------------------------------------------------------------

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

By: Digium Subversion (svnbot) 2008-01-11 13:06:08.000-0600

Repository: asterisk
Revision: 98308

U   trunk/codecs/codec_resample.c

------------------------------------------------------------------------
r98308 | russell | 2008-01-11 13:06:05 -0600 (Fri, 11 Jan 2008) | 9 lines

Kevin noted that the thing that I _actually_ changed here was that I converted
a value from a double, to a float, back to a double.  Sure enough, when I changed
my interim variable back to a double, it still blows up.  Switching all of these
to a float fixes the problem.  This seems like a compiler bug where a double passed
as an argument isn't getting properly aligned, so I'll have to see if I can replicate
it with a small test program.

(related to issue ASTERISK-11195)

------------------------------------------------------------------------

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