[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [nas] nasd outputs only part of a sample, client stalls -- exceptunder strace



On Mon, 8 Oct 2007, Erik Auerswald wrote:

Hi,

[...]
  Erik, I just wanted to let you know I have't forgotten about this
  issue.  There's just been alot going on around here.

I don´t have much time either, the machine in question has been
downgraded to a 2.6.20 kernel which doesn´t show these problems.

  I think we only use these when waiting for the device to be
  available when ReleaseDevice is enabled...

AFAICT you are right.

Erik


  Hi,

  I was able to load a 2.6.22.6 kernel on a laptop using a Pentium-M
  (Centrino) processor at 1.7Ghz.  I had the dynticks/tickless stuff
  enabled (though I tried disabled as well w/o effect).

  Unfortunately I was not able to duplicate the problem with current
  svn nas (r264).  I did not try virgin 1.9 nas.

  However, I was able to almost-duplicate it by removing the
  enable/disableIntervalProc calls in intervalProc - the server would
  hang after playing a couple of seconds of audio.  In reality I don't
  think we should be calling those in intervalProc anyway, as then we
  provide an excellent opportunity to lose signals.

  So...

  Attached is a patch to current svn (r264) that removes these calls
  from intervalProc and replaces them with SetTimer() calls.  This
  will eliminate the timer interrupts (without disabling the handler)
  while intervalProc is running; then schedule at least one more
  interrupt before returning, by resetting the timer to the current
  sample rate, so the spice can continue to flow :)

  This should ensure that there is no possibility that we will miss a
  signal.  In theory.  :)

  It does work fine here on 2.6.22.6 now, as well as on a 2.4.33 kernel on
  another machine.  Perhaps it will work for you guys as well?

  It's not committed yet, so let me know if it changes anything for
  better or worse.

--
Happy cheese in fear                 | Jon Trulson
against oppressor, rebel! | mailto:jon@xxxxxxxxxxx Brocolli, hostage. -Unknown | #include <std/disclaimer.h>
Index: server/dda/voxware/auvoxware.c
===================================================================
--- server/dda/voxware/auvoxware.c	(revision 264)
+++ server/dda/voxware/auvoxware.c	(working copy)
@@ -197,10 +197,6 @@
 #include <audio/Aproto.h>
 #include "au.h"
 
-#ifdef sco
-static AuBool scoAudioBlocked = AuFalse;
-#endif /* sco */
-
 static AuBool processFlowEnabled;
 static void disableProcessFlow(void);
 static void closeDevice(void);
@@ -365,10 +361,13 @@
     return;
 }
 
+static AuBool audioBlocked = AuFalse;
+
 AuBlock _AuBlockAudio(void)
 {                                                          
     sigset_t set;
 
+    audioBlocked = AuTrue;
     sigemptyset(&set); 
     sigaddset(&set, SIGALRM);
     sigprocmask(SIG_BLOCK, &set, NULL);
@@ -379,6 +378,7 @@
 {
     sigset_t set;
 
+    audioBlocked = AuFalse;
     sigemptyset(&set);
     sigaddset(&set, SIGALRM);
     sigprocmask(SIG_UNBLOCK, &set, NULL);
@@ -392,14 +392,14 @@
 AuBlock
 AuBlockAudio(void)
 {
-    scoAudioBlocked = AuTrue;
+    audioBlocked = AuTrue;
     return 0;
 }
 
 void
 AuUnBlockAudio(AuBlock id)
 {
-    scoAudioBlocked = AuFalse;
+    audioBlocked = AuFalse;
 }
 
 #endif /* sco */
@@ -706,7 +706,7 @@
     AuInt32 foo;
     struct itimerval ntval, otval;
 
-    if (NasConfig.DoDebug) {
+    if (NasConfig.DoDebug > 5) {
         osLogMsg("setTimer(rate = %d);\n", rate);
         IDENTMSG;
     }
@@ -1139,14 +1139,15 @@
     extern void AuProcessData();
 
 #if !defined(sco)
-    disableIntervalProc();   
+    setTimer(0);                /* turn off the timer here so that
+                                   a potential race is avoided */
 
     if (processFlowEnabled)
         AuProcessData();
 
-    enableIntervalProc();   
+    setTimer(sndStatOut.curSampleRate);
 #else
-    if (!scoAudioBlocked && processFlowEnabled)
+    if (!audioBlocked && processFlowEnabled)
         AuProcessData();
 #endif /* sco */
 }