Bugzilla – Bug 104884
sound does not work after suspend to disk
Last modified: 2005-08-18 12:03:35 UTC
before suspend to disk no apps uses sound device (sound module: snd_intel8x0), but after suspend all applications tell that /dev/dsp: device or resurce busy.
Jaroslav, can you look into this please? Thanks!
It might be related to bug #104100 . Can you give me output from 'lsmod' and 'fuser -v /dev/dsp' and 'fuser -v /dev/snd/pcmC0D0p' after resume ?
Created attachment 46149 [details] output of lsmod
# fuser -v /dev/snd/pcmC0D0p USER PID ACCESS COMMAND /dev/snd/pcmC0D0p panther 6440 f...m knotify The output of fuser -v /dev/dsp is empty. lsmod output is attached to bug report. It seems related to both bug #104100 and bug #104078. Somehow I didn't see
> It seems related to both bug #104100 and bug #104078. Somehow I didn't see also: i saw only artsd in process list. after killing knotify I can write /dev/dsp but xmms with alsa output does not work, only after restarting of xmms.
Could you try to compile and test the alsa-lib package from the ALSA's CVS? See http://www.alsa-project.org - Download link. The changes should be also in beta3, but I would appreciate faster testing...
Fisrt, cvs checkout was at about 12:00 CEST. Usually when xmms is paused, it can continue playing that song after resume. When the song ends, next can't be played. Now i installed the alsa-lib (to /usr/lib + I run ldconfig). After resume xmms works. (in this case neither artsd nor knotify runs).
after resume when nothing using /dev/snd/pcmC0D0p, but only the cvs version of alsa-lib works. With running knotify it still doesn't work (both xmms and knotify uses the device, and the next song can't be played).
Please, attach or include contents from files ~/.kde/share/config/kcmartsrc and ~/.kde/share/config/knotifyrc .
Contents: panther@zeratul:~> cat ~/.kde/share/config/kcmartsrc [Arts] AddOptions= Arguments=\s-F 10 -S 4096 -a alsa -s 60 -m artsmessage -c drkonqi -l 3 -f AudioIO=alsa AutoSuspend=true Bits=0 DeviceName= FullDuplex=false Latency=250 NetworkTransparent=false SamplingRate=0 StartRealtime=true StartServer=true SuspendTime=60 panther@zeratul:~> cat ~/.kde/share/config/knotifyrc [Misc] LastConfiguredApp=Akregator [StartProgress] Arts Init=true KNotify Init=true Use Arts=true
Do you see any error messages from xmms (try run it from a terminal window)? Please, send me 'fuser -v /dev/snd/pcmC0D0p' and 'ps ax | grep -E "(arts|knotify|xmms)"' contents after resume when knotify is enabled and CVS version of alsa-lib is installed. Also, you might use 'aplay' tool instead xmms from the terminal window.
zeratul:~ # ps ax | grep -E "(arts|knotify|xmms)" 31067 pts/2 SL 0:00 knotify 31104 pts/1 SLl+ 0:01 xmms 31410 pts/3 S+ 0:00 grep -E (arts|knotify|xmms) zeratul:~ # fuser -v /dev/snd/pcmC0D0p USER PID ACCESS COMMAND /dev/snd/pcmC0D0p panther 31067 f...m knotify My Konsole has more tabs, also knotify used when i try to close it. Before suspend it writes to output: "auto_sink: Could not load polyp Cannot open client akode: ALSA fragment-size: 940" after resume it says (when try to close the window): "auto_sink: Could not load polyp Cannot open client ALSA lib pcm_direct.c:218:(make_local_socket) connect failed: /tmp/alsa-dmix-31067-1124289631-49777: No such file or directory ALSA lib pcm_dmix.c:850:(snd_pcm_dmix_open) unable to connect client" XMMS: at startup: "/usr/lib/xmms/General/libir.so: undefined symbol: irapp_thread /usr/lib/xmms/Visualization/libmadspin.so: undefined symbol: config_window" after resume: ALSA lib pcm_direct.c:218:(make_local_socket) connect failed: /tmp/alsa-dmix-31067-1124289631-49777: No such file or directory ALSA lib pcm_dmix.c:850:(snd_pcm_dmix_open) unable to connect client ** WARNING **: alsa_setup(): Failed to open pcm device (default): Nincs ilyen fájl vagy könyvtár
So we are in the really same situation as reported in bug #104100 . Please, could you kill artsd and knotify and reproduce the 'connect failed' bug with plain aplay? 1) on first console give 'aplay <some_wav_file>' 2) send output from 'ps ax | grep aplay' 3) suspend 4) resume 5) send output from 'ps ax | grep aplay' after resume 6) try run second 'aplay <some_wav_file>' in another terminal window (and you should get the 'connect failed bug' here) If you can reproduce, I will ask you to provide more debug info (with special alsa-lib).
> 2) send output from 'ps ax | grep aplay' zeratul:~ # ps ax | grep aplay 32715 pts/2 SL+ 0:00 aplay music/sc/music/protoss1.wav 32717 ? Ss 0:00 aplay music/sc/music/protoss1.wav 32719 pts/3 R+ 0:00 grep aplay > 5) send output from 'ps ax | grep aplay' after resume zeratul:~ # ps ax | grep aplay 32715 pts/2 SL+ 0:01 aplay music/sc/music/protoss1.wav 542 pts/3 S+ 0:00 grep aplay > 6) try run second 'aplay <some_wav_file>' in another terminal window (and you > should get the 'connect failed bug' here) panther@zeratul:~> aplay music/sc/music/tvict.wav ALSA lib pcm_direct.c:218:(make_local_socket) connect failed: /tmp/alsa-dmix-32715-1124299090-838259: No such file or directory ALSA lib pcm_dmix.c:850:(snd_pcm_dmix_open) unable to connect client aplay: main:540: audio open error: No such file or directory After killing the first aplay, I don't get any error messages.
I forget to tell, that knotify is not running.
Created attachment 46406 [details] Run aplay using LD_PRELOAD to debug library
Please, enable SERVER_JOB_DEBUG in pcm_direct.c (alsa-lib) like: Index: pcm_direct.c =================================================================== RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_direct.c,v retrieving revision 1.43 diff -u -r1.43 pcm_direct.c --- pcm_direct.c 17 Aug 2005 14:00:32 -0000 1.43 +++ pcm_direct.c 18 Aug 2005 07:29:39 -0000 @@ -226,7 +226,7 @@ return sock; } -#if 0 +#if 1 #define SERVER_JOB_DEBUG #define server_printf(fmt, args...) printf(fmt, ##args) #else Then run the debug library exactly in same way as described in comment #13 (don't attach the ps outputs). I need the output from console/terminal from the first aplay command (strip duplicate lines, please). I also attached a small 'go' script to run aplay with the debug library without installing alsa-lib to system paths. Simply, correct paths in this file for aply and alsa-lib.
*** Bug 104100 has been marked as a duplicate of this bug. ***
Created attachment 46450 [details] testcase outputs Please read first bug/README in the tar.bz2 file.
Thanks, please, modify pcm_direct.c in this way (I need to know the errno value) and retry. Don't enable DBG= lines in your go script. I need only "DIRECT SERVER: " lines printed to stdout. --- pcm_direct.c 17 Aug 2005 14:00:32 -0000 1.43 +++ pcm_direct.c 18 Aug 2005 10:30:40 -0000 @@ -226,7 +226,7 @@ return sock; } -#if 0 +#if 1 #define SERVER_JOB_DEBUG #define server_printf(fmt, args...) printf(fmt, ##args) #else @@ -287,7 +287,7 @@ server_printf("DIRECT SERVER STARTED\n"); while (1) { ret = poll(pfds, current + 1, 500); - server_printf("DIRECT SERVER: poll ret = %i, revents[0] = 0x%x\n", ret, pfds[0].revents); + server_printf("DIRECT SERVER: poll ret = %i, revents[0] = 0x%x, errno = %i\n", ret, pfds[0].revents, errno); if (ret < 0) /* some error */ break; if (ret == 0 || (pfds[0].revents & (POLLERR | POLLHUP))) { /* timeout or error? */
I think that errno would be EINTR, so bellow patch might fix the resume issue: diff -u -r1.43 pcm_direct.c --- pcm_direct.c 17 Aug 2005 14:00:32 -0000 1.43 +++ pcm_direct.c 18 Aug 2005 10:37:50 -0000 @@ -226,7 +226,7 @@ return sock; } -#if 0 +#if 1 #define SERVER_JOB_DEBUG #define server_printf(fmt, args...) printf(fmt, ##args) #else @@ -287,9 +287,13 @@ server_printf("DIRECT SERVER STARTED\n"); while (1) { ret = poll(pfds, current + 1, 500); - server_printf("DIRECT SERVER: poll ret = %i, revents[0] = 0x%x\n", ret, pfds[0].revents); - if (ret < 0) /* some error */ + server_printf("DIRECT SERVER: poll ret = %i, revents[0] = 0x%x, errno = %i\n", ret, pfds[0].revents, errno); + if (ret < 0) { + if (errno == EINTR) + continue; + /* some error */ break; + } if (ret == 0 || (pfds[0].revents & (POLLERR | POLLHUP))) { /* timeout or error? */ struct shmid_ds buf; snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
(In reply to comment #20) DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 9 DIRECT SERVER: nattch = 2 (the same during play) DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 9 DIRECT SERVER: nattch = 2 DIRECT SERVER: poll ret = -1, revents[0] = 0x0, errno = 4 Suspended. Trying resume. Done. DIRECT SERVER EXIT I have a little bit different version of the file. #if 1 // is in line number 225 (in mcedit) server_printf("DIRECT SERVER STARTED\n"); // is in line number 256. Comment post breaks your copied diff files, also could you attach them? (now i'll try your next code)
Created attachment 46461 [details] The official patch solving the resource server problem (it is also commited to ALSA CVS)
Created attachment 46462 [details] pcm_direct.c.rej file (In reply to comment #23) (before suspend:) DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 9 DIRECT SERVER: nattch = 2 DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 9 DIRECT SERVER: nattch = 2 DIRECT SERVER: poll ret = -1, revents[0] = 0x0, errno = 4 DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 4 DIRECT SERVER: nattch = 2 Suspended. Trying resume. Done. DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 4 DIRECT SERVER: nattch = 2 DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 4 DIRECT SERVER: nattch = 2 DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 4 DIRECT SERVER: nattch = 2 underrun!!! (at least 0,067 ms long) DIRECT SERVER: poll ret = 0, revents[0] = 0x0, errno = 4 DIRECT SERVER: nattch = 2 (the same after resume, the .wav file playing works) The out.txt is still rejected (the original files are not the same). I attach the .rej file, i hope this also helps.
It seems that it solved the problem. The ALSA anonymous CVS will sync in some hours, so you might try the official alsa-lib code then. The changes will be in SL10-beta3 release. If you disable the debugging in pcm_direct.c (change #if 1 to #if 0 - reverse things as in comment #17), then install modified alsa-lib to system directories, you may test the new alsa-lib immediately with the former testcase (xmms, knotify, arts).
Now sound works as expected (also after resume I can start other aplay-s, xmms, knotify, etc. and the next song is also playable (after another resume), with #if 0 but patched with out.txt in comment #23)
Fine. This issue is solved then. Thank you for your report and tests.