[Home]

Summary:ASTERISK-06543: chan_alsa randomly crashing asterisk
Reporter:sbisker (sbisker)Labels:
Date Opened:2006-03-14 07:43:02.000-0600Date Closed:2006-04-15 18:42:09
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) alsa-monitor.h
( 1) crash.txt
Description:All,

I'm having a problem with a recent asterisk install on Centos 4.2.  Everything is running fine with one exeption.

If I use chan_alsa asterisk will crash, with no warnings, no segfault, no nothing.  Switching to chan_oss fixes the problem, but would be nice to have a working chan_alsa.   I figured the crashing problem out by isolating all chan_alsa traffic on a stand-alone server with zapdummy  and communicated via IAX from the main server.  After about 4-5 uses, the server dies.
Comments:By: Olle Johansson (oej) 2006-03-14 14:49:24.000-0600

Please start with "asterisk -cvvvvddddgn | tee /tmp/crash.txt" and see if you can't get a message or a core dump from the crash.

By: sbisker (sbisker) 2006-03-17 11:49:58.000-0600

Uploaded crash.txt .  Backtrace below generated from asterisk -cvvvvddddgn terminated with signal 11

#0  0x073fb388 in _snd_pcm_adpcm_open () from /lib/libasound.so.2
#1  0x073e11dd in snd_pcm_avail_update () from /lib/libasound.so.2
#2  0x073e60ac in snd_pcm_read_areas () from /lib/libasound.so.2
#3  0x073ff00e in snd_pcm_mmap_readi () from /lib/libasound.so.2
#4  0x073df4c3 in snd_pcm_readi () from /lib/libasound.so.2
ASTERISK-1  0x00fbfcbd in alsa_read (chan=0x86580c0) at chan_alsa.c:695
ASTERISK-2  0x08065e9a in ast_read (chan=0x86580c0) at channel.c:1900
ASTERISK-3  0x080684f8 in ast_channel_bridge (c0=0x86570a8, c1=0x86580c0, config=0xb7bc9830, fo=0xb7bc8ce8, rc=0xb7bc8cec)
   at channel.c:3267
ASTERISK-4  0x00634d35 in ast_bridge_call (chan=0x86570a8, peer=0x86580c0, config=0xb7bc9830) at res_features.c:1316
ASTERISK-5  0x00417f3a in dial_exec_full (chan=0x86570a8, data=Variable "data" is not available.
) at app_dial.c:1559
ASTERISK-6 0x0041a3ed in dial_exec (chan=0x4000, data=0x860c188) at app_dial.c:1601
ASTERISK-7 0x08090abd in pbx_extension_helper (c=0x86570a8, con=Variable "con" is not available.
) at pbx.c:544
ASTERISK-8 0x08091d86 in __ast_pbx_run (c=0x86570a8) at pbx.c:2218
ASTERISK-9 0x0809383c in pbx_thread (data=0x4000) at pbx.c:2505
ASTERISK-10 0x0048a341 in start_thread () from /lib/tls/libpthread.so.0
ASTERISK-11 0x0030a6fe in clone () from /lib/tls/libc.so.6

By: Andrey S Pankov (casper) 2006-04-10 14:13:16

Do you have alsa support in the running kernel?

By: sbisker (sbisker) 2006-04-10 18:55:29

ALSA is the de-facto sound system for 2.6 series of kernels.  It emulates oss (which works by the way).  I'm not getting a kernel panic, just a core dump when two or more channels try to dial Console/DSP at the same time.  Instead of ringing busy it crashes asterisk.

By: Andrey S Pankov (casper) 2006-04-10 19:30:14

You are wrong... ALSA support may be not in kernel and ALSA modules can not be installed at all.

By: sbisker (sbisker) 2006-04-11 07:56:36

If sound drivers weren't loaded then chan_alsa or chan_oss wouldn't even work, but they do work .. chan_oss is flawless, while chan_alsa crashes asterisk when two or more extensions try to dial console/dsp.    Did you read the previous posts.  Below is what happens if alsa modules aren't loaded.

Apr 11 08:55:23 WARNING[3694]: chan_oss.c:988 oss_request: oss_request ty <Console> data 0x0xb79b9960 <dsp>
Apr 11 08:55:23 WARNING[3694]: chan_oss.c:632 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
<< Call to device 'dsp' dnid '(null)' rdnis '(null)' on console from 'Scott Bisker' <5285> >>
<< Auto-answered >>
   -- Called dsp
   -- OSS/dsp answered IAX2/192.168.1.15:4569-1
Apr 11 08:55:24 WARNING[3694]: chan_oss.c:632 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
Apr 11 08:55:25 WARNING[3694]: chan_oss.c:632 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
Apr 11 08:55:26 WARNING[3694]: chan_oss.c:632 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
Apr 11 08:55:27 WARNING[3694]: chan_oss.c:632 setformat: Unable to re-open DSP device /dev/dsp: No such file or directory
<< Hangup on console >>
 == Spawn extension (local, 66, 1) exited non-zero on 'IAX2/192.168.1.15:4569-1'

By: Andrey S Pankov (casper) 2006-04-11 09:18:16

Does compiling chan_alsa with alsa-monitor.h (I've uploaded fixed version) helps?



By: sbisker (sbisker) 2006-04-11 10:26:47

That makes it worse.  Backtrace below.  I am now running against SVN Trunk due to another issue.

#0  0x0022a7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0026a7d5 in raise () from /lib/tls/libc.so.6
#2  0x0026c149 in abort () from /lib/tls/libc.so.6
#3  0x00263db1 in __assert_fail () from /lib/tls/libc.so.6
#4  0x073de45b in snd_pcm_state () from /lib/libasound.so.2
ASTERISK-1  0x00c76679 in alsa_read (chan=0x8fe99d8) at chan_alsa.c:690
ASTERISK-2  0x08068063 in __ast_read (chan=0x8fe99d8, dropaudio=0) at channel.c:1872
ASTERISK-3  0x0806a587 in ast_channel_bridge (c0=0x8f929e0, c1=0x8fe99d8, config=0xb7974830, fo=0xb7973cf8, rc=0xb7973cfc) at channel.c:2024
ASTERISK-4  0x0058f26b in ast_bridge_call (chan=0x8f929e0, peer=0x8fe99d8, config=0xb7974830) at res_features.c:1302
ASTERISK-5  0x00510d5a in dial_exec_full (chan=0x8f929e0, data=Variable "data" is not available.
) at app_dial.c:1568
ASTERISK-6 0x0051326d in dial_exec (chan=0x0, data=0x6) at app_dial.c:1611
ASTERISK-7 0x0807c6de in pbx_extension_helper (c=0x8f929e0, con=Variable "con" is not available.
) at pbx.c:508
ASTERISK-8 0x0807da96 in __ast_pbx_run (c=0x8f929e0) at pbx.c:2063
ASTERISK-9 0x0807f62c in pbx_thread (data=0x0) at pbx.c:2343
ASTERISK-10 0x0048a341 in start_thread () from /lib/tls/libpthread.so.0
ASTERISK-11 0x0030a6fe in clone () from /lib/tls/libc.so.6

By: Andrey S Pankov (casper) 2006-04-11 10:34:25

Can't reproduce on my system in both variants (with or without alsa-monitor).
The only difference I use latest svn trunk and sip instead of iax2.

By: sbisker (sbisker) 2006-04-11 10:41:06

Since switching to Trunk  I've only tested with alsa-monitor.  I just tried again without alsa-monitor and I get the same error.  Something has changed between 1.2.5 and Trunk to make the problem worse.  Here's the console output

*CLI>     -- Accepting AUTHENTICATED call from 192.168.1.15:
      > requested format = g729,
      > requested prefs = (),
      > actual format = gsm,
      > host prefs = (),
      > priority = mine
   -- Executing Dial("IAX2/192.168.1.15:4569-1", "Console/dsp") in new stack
<< Call placed to 'dsp' on console >>
<< Auto-answered >>
   -- Called dsp
   -- ALSA/hw:0,0 answered IAX2/192.168.1.15:4569-1
asterisk: pcm.c:870: snd_pcm_state: Assertion `pcm' failed.
Aborted (core dumped)


And the BT:


#0  0x0022a7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x0026a7d5 in raise () from /lib/tls/libc.so.6
#2  0x0026c149 in abort () from /lib/tls/libc.so.6
#3  0x00263db1 in __assert_fail () from /lib/tls/libc.so.6
#4  0x073de45b in snd_pcm_state () from /lib/libasound.so.2
ASTERISK-1  0x00f25d25 in alsa_read (chan=0x81c3f80) at chan_alsa.c:690
ASTERISK-2  0x08068063 in __ast_read (chan=0x81c3f80, dropaudio=0) at channel.c:1872
ASTERISK-3  0x0806a587 in ast_channel_bridge (c0=0x816d530, c1=0x81c3f80, config=0xb79b5830, fo=0xb79b4cf8, rc=0xb79b4cfc) at channel.c:2024
ASTERISK-4  0x00c3626b in ast_bridge_call (chan=0x816d530, peer=0x81c3f80, config=0xb79b5830) at res_features.c:1302
ASTERISK-5  0x00f4ad5a in dial_exec_full (chan=0x816d530, data=Variable "data" is not available.
) at app_dial.c:1568
ASTERISK-6 0x00f4d26d in dial_exec (chan=0x0, data=0x6) at app_dial.c:1611
ASTERISK-7 0x0807c6de in pbx_extension_helper (c=0x816d530, con=Variable "con" is not available.
) at pbx.c:508
ASTERISK-8 0x0807da96 in __ast_pbx_run (c=0x816d530) at pbx.c:2063
ASTERISK-9 0x0807f62c in pbx_thread (data=0x0) at pbx.c:2343
ASTERISK-10 0x0048a341 in start_thread () from /lib/tls/libpthread.so.0
ASTERISK-11 0x0030a6fe in clone () from /lib/tls/libc.so.6

By: Andrey S Pankov (casper) 2006-04-12 09:56:43

Please specify exact versions of your kernel and libalsa (libasound).

Ensure that alsa support is from the running kernel, -devel packages match
lib* version and you really compiled asterisk with system header/libs.

If you use rpm please use 'rpm -qa|grep alsa' command.
Please provide 'uname -a' and 'lsmod' output as well.

By: sbisker (sbisker) 2006-04-12 10:09:06

System is CentOS 4.2

uname -a
Linux isddev01usae.harvardgrp.com 2.6.9-22.0.1.ELsmp #1 SMP Thu Oct 27 13:14:25 CDT 2005 i686 i686 i386 GNU/Linux


lsmod
Module                  Size  Used by
snd_pcm_oss            52345  1
md5                     8001  1
ipv6                  240097  18
ztdummy                 7748  0
zaptel                196740  5 ztdummy
crc_ccitt               6081  1 zaptel
dm_mirror              28449  0
dm_mod                 58949  1 dm_mirror
button                 10449  0
battery                12869  0
ac                      8773  0
snd_usb_audio          61729  1
snd_mixer_oss          21825  1 snd_pcm_oss
snd_pcm                91973  2 snd_pcm_oss,snd_usb_audio
snd_timer              27973  1 snd_pcm
snd_page_alloc         13641  1 snd_pcm
snd_usb_lib            15681  1 snd_usb_audio
snd_rawmidi            27749  1 snd_usb_lib
snd_seq_device         11849  1 snd_rawmidi
snd                    56997  7 snd_pcm_oss,snd_usb_audio,snd_mixer_oss,snd_pcm,snd_timer,snd_rawmidi,snd_seq_device
soundcore              12961  2 snd
uhci_hcd               32729  0
ehci_hcd               31813  0
e1000                  96429  0
floppy                 58065  0
ext3                  118729  2
jbd                    59481  1 ext3
raid1                  19521  2
ata_piix               13253  6
libata                 47901  1 ata_piix
sd_mod                 20545  8
scsi_mod              116429  2 libata,sd_mod
rpm -qa |grep alsa
alsa-lib-devel-1.0.6-5.RHEL4
alsa-lib-1.0.6-5.RHEL4
alsa-utils-1.0.6-4

rpm -qa |grep kernel |grep 2.6.9-22.0.1
kernel-smp-devel-2.6.9-22.0.1.EL
kernel-smp-2.6.9-22.0.1.EL
kernel-2.6.9-22.0.1.EL
kernel-devel-2.6.9-22.0.1.EL

By: Andrey S Pankov (casper) 2006-04-12 10:38:35

It would be nice if you try at least kernel 2.6.14 and libalsa 1.0.10.
Can you use a generic soundcard, not usb one?

By: sbisker (sbisker) 2006-04-12 10:45:19

If chan_oss works witih alsa oss emulation and its' not causing a kernel panic, that would lead me to believe that the problem is with chan_alsa, not the kernel, alsa lib, or soundcard.  I can try with a different sound card, but not the others.

By: Andrey S Pankov (casper) 2006-04-12 11:03:31

If you want the bug to be fixed you should do your best. And please use trunk branch for all your tests.

Since the driver crashes in libasound on a call to a function with one parameter
which can't be null the problem may be in alsa support in the kernel and libalsa.

First option is to try another sound card. I can't repoduce the issue on my sytem.

By: sbisker (sbisker) 2006-04-12 12:09:40

Changed soundcard from Creative USB to ens1371 and core dump on module load has gone away. I've tried to duplicate the core dump by simulating multiple calls to chan_alsa to no avail.  Perhaps the alsa method used to see if the USB device is in use doesn't return the proper code.  I'll montior for the next few days to see if there are any crashes, but I doubt there will be.

Thanks casper!

By: Andrey S Pankov (casper) 2006-04-12 12:46:29

You are always welcome.

Let's close this one as well for now...

By: Joshua C. Colp (jcolp) 2006-04-15 18:42:08

Closed since reporter changed conditions, and issue went away. If it reoccurs feel free to reopen this bug.