From natedac@daconcepts.dyndns.org  Sun Mar 18 21:58:48 2001
Return-Path: <natedac@daconcepts.dyndns.org>
Received: from daconcepts.dyndns.org (wks-166-129-114.kscable.com [24.166.129.114])
	by hub.freebsd.org (Postfix) with ESMTP id E782037B718
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 18 Mar 2001 21:58:47 -0800 (PST)
	(envelope-from natedac@daconcepts.dyndns.org)
Received: (from natedac@localhost)
	by daconcepts.dyndns.org (8.11.3/8.11.3) id f2J5rcE42369;
	Sun, 18 Mar 2001 23:53:38 -0600 (CST)
	(envelope-from natedac)
Message-Id: <200103190553.f2J5rcE42369@daconcepts.dyndns.org>
Date: Sun, 18 Mar 2001 23:53:38 -0600 (CST)
From: natedac@kscable.com
Reply-To: natedac@kscable.com
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Kernel sound driver may die if a program crashes>> update
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         25910
>Category:       kern
>Synopsis:       [sound] Kernel sound driver may die if a program crashes (workaround)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-multimedia
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 18 22:00:02 PST 2001
>Closed-Date:    Sun Sep 11 18:57:53 GMT 2005
>Last-Modified:  Sun Sep 11 18:57:53 GMT 2005
>Originator:     Nate Dannenberg
>Release:        FreeBSD 4.3-BETA i386
>Organization:
n/a
>Environment:

System: FreeBSD piccolo 4.3-BETA FreeBSD 4.3-BETA #1: Fri Mar 16 16:32:20
CST 2001
natedac@piccolo.daconcepts.dyndns.org:/usr/src/sys/compile/PICCOLO i386

IBM Aptiva with ESS Solo-1 audio

>Description:

If a program crashes while it's using the sound device, the kernel fails 
to close the device so that other programs may use it.  The device is left 
in an open, "busy" state.

>How-To-Repeat:

Run any program like mpg123, and find a way to cause it to crash.  Now try 
to play something else with that or any other audio application.

>Fix:

Don't compile the sound driver into the kernel.  Instead, use the loadable 
module.  I got a chance to test this out, and sure enough, I can restore 
the sound after the driver dies, without rebooting the system (which is 
the case with the in-kernel driver)...

Exit all audio applications, including those that may be using the mixer 
device (gqmpeg, aumix) or that are just acting as a server/daemon for 
other programs (esd).  Unload the driver modules and reload them.

These few lines will automate the process a little bit:

#!/usr/local/bin/bash   # or any other path-capable shell.
killall esd
killall mpg123
killall gqmpeg
killall xmp
killall aumix

sleep 1

kldunload snd_pcm
kldunload snd_solo

sleep 1

kldload /modules/snd_pcm
kldload /modules/snd_solo

mixer line 0
mixer line1 0
mixer mic 0
mixer synth 0
mixer cd 100
mixer pcm 50
mixer vol 50
#  end...

If the sound drivers are compiled into the kernel, it is necessary to shut 
the computer down and re-start it to restore sound once the driver dies.  
With the modules, the above code seems to work, preserving what may be 
rather important uptime.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->cg 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Mar 23 21:24:48 PST 2001 
Responsible-Changed-Why:  
Cameron is the soundmeister 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25910 
Responsible-Changed-From-To: cg->sound 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Sep 9 19:33:21 GMT 2004 
Responsible-Changed-Why:  
With permission, reassign to mailing list alias. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25910 
State-Changed-From-To: open->feedback 
State-Changed-By: netchild 
State-Changed-When: Sun Sep 11 09:36:25 GMT 2005 
State-Changed-Why:  
The sound system changed a lot since 4.3. Does this still apply to 
5.[34] or -current? 

Internal note: This PR should be closed after 2 months if we don't get 
an answer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25910 
State-Changed-From-To: feedback->closed 
State-Changed-By: netchild 
State-Changed-When: Sun Sep 11 18:57:04 GMT 2005 
State-Changed-Why:  
Originator address bounces (invalid recipient). 

If someone has this problem too, please open a new PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=25910 
>Unformatted:
