Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6269854

Call to AudioClip.loop blocks forever on some sound cards

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1 P1
    • 6
    • 5.0
    • client-libs
    • b48
    • x86
    • windows_xp

        FULL PRODUCT VERSION :
        java version "1.5.0_02"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
        Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

        ADDITIONAL OS VERSION INFORMATION :
        - Microsoft Windows XP [Version 5.1.2600]

        EXTRA RELEVANT SYSTEM CONFIGURATION :
        Creative Sound Blaster Live! 24-bit - driver version 5.12.01.315
        Createive SB Audigy 2 ZS Audio [DCC0] - driver version 5.12.01.0445-1.84.0050



        A DESCRIPTION OF THE PROBLEM :
        A looping sound is stopped and started repeatedly using AudioClip.loop() and stop(). On many sound cards, a call to loop() will block, permanently. The sound is not short (around 4 seconds long). The calls are well-spaced (1 second apart).

        A thread dump shows that com.sun.media.sound.DirectAudioDevice.DirectDL.flush() is sleeping over and over, waiting for nativeRefCount to go to 0. In other words, it believes that a native call is in progress for that clip.

        See "Additonal Configuratino Information" for sound cards that exhibit this problem - so far they are all Creative models. Not all Creative models exhibit this however. They generally fail on the following test applet before reaching 50 calls to loop().

        These cards don't have problems playing other games. Updating to the latest version of the drivers hasn't helped. This seems to be a bad interaction between Java 1.5 and these cards.

        This is a serious problem for www.pogo.com - Electronic Arts highly popular casual games site. Lottso and Tripeaks are two games that reliably reproduce it.



        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Download the sound from the indicated url and run the applet pasted below



        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Sound should repeat forever
        ACTUAL -
        Sound will stop, often before 10 plays, generally before 50 (but not always).

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        No error message. Here's the problem thread, followed by the full thread dump.

        "Thread-35" daemon prio=4 tid=0x0e25a0f8 nid=0x11e4 waiting on condition [0x0fcdf000..0x0fcdfc68]
        at java.lang.Thread.sleep(Native Method)
        at com.sun.media.sound.DirectAudioDevice$DirectDL.flush(Unknown Source)
        at com.sun.media.sound.JavaSoundAudioClip.startImpl(Unknown Source)
        - locked <0x05a71728> (a com.sun.media.sound.JavaSoundAudioClip)
        at com.sun.media.sound.JavaSoundAudioClip.loop(Unknown Source)
        - locked <0x05a71728> (a com.sun.media.sound.JavaSoundAudioClip)
        at sun.plugin.viewer.context.AppletAudioClip.loop(Unknown Source)
        - locked <0x05a72ed0> (a sun.plugin.viewer.context.AppletAudioClip)
        at sun.plugin.viewer.context.PluginAudioClip.loop(Unknown Source)
        at com.pogo.util.applet.SoundPlayer.run(SoundPlayer.java:212)
        at java.lang.Thread.run(Unknown Source)



        Full thread dump Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode):

        "TimerQueue" daemon prio=5 tid=0x0e816168 nid=0x1824 in Object.wait() [0x120bf000..0x120bf9e8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05d5a400> (a javax.swing.TimerQueue)
        at javax.swing.TimerQueue.run(Unknown Source)
        - locked <0x05d5a400> (a javax.swing.TimerQueue)
        at java.lang.Thread.run(Unknown Source)

        "TimerQueue" daemon prio=5 tid=0x0e269c88 nid=0xba4 in Object.wait() [0x11b8f000..0x11b8fb68]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05c8de30> (a javax.swing.TimerQueue)
        at javax.swing.TimerQueue.run(Unknown Source)
        - locked <0x05c8de30> (a javax.swing.TimerQueue)
        at java.lang.Thread.run(Unknown Source)

        "ConsoleWriterThread" daemon prio=7 tid=0x0e2d1a28 nid=0x1804 in Object.wait() [0x0213f000..0x0213fbe8]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.sun.deploy.util.ConsoleTraceListener$ConsoleWriterThread.run(Unknown Source)
        - locked <0x050479f0> (a java.lang.Object)

        "AWT-EventQueue-1" prio=7 tid=0x0e36c310 nid=0x2714 waiting on condition [0x01b1f000..0x01b1fc68]
        at sun.plugin.JavaRunTime.dumpAllStacks(Native Method)
        at sun.plugin.util.PluginConsoleController.dumpAllStacks(Unknown Source)
        at com.sun.deploy.util.ConsoleWindow$1.actionPerformed(Unknown Source)
        at javax.swing.JComponent$ActionStandin.actionPerformed(Unknown Source)
        at javax.swing.SwingUtilities.notifyAction(Unknown Source)
        at javax.swing.JComponent.processKeyBinding(Unknown Source)
        at javax.swing.KeyboardManager.fireBinding(Unknown Source)
        at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
        at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
        at javax.swing.JComponent.processKeyBindings(Unknown Source)
        at javax.swing.JComponent.processKeyEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
        at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

        "Thread-2283" prio=5 tid=0x0e2d1010 nid=0x10e8 runnable [0x00000000..0x0df5f7f0]

        "JDWP Command Reader" daemon prio=5 tid=0x024d5c88 nid=0x480 runnable [0x00000000..0x00000000]

        "Direct Clip" daemon prio=7 tid=0x024e85f0 nid=0x1680 in Object.wait() [0x1060f000..0x1060f9e8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05bd74c0> (a java.lang.Object)
        at java.lang.Object.wait(Unknown Source)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x05bd74c0> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

        "Direct Clip" daemon prio=7 tid=0x0e332f28 nid=0x20ec in Object.wait() [0x0f55f000..0x0f55fa68]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05bce6d0> (a java.lang.Object)
        at java.lang.Object.wait(Unknown Source)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        - locked <0x05bce6d0> (a java.lang.Object)
        at java.lang.Thread.run(Unknown Source)

        "Direct Clip" daemon prio=7 tid=0x0e33e088 nid=0x924 in Object.wait() [0x11fbf000..0x11fbfc68]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05bb7d48> (a java.lang.Object)
        at com.sun.media.sound.DirectAudioDevice$DirectDL.write(Unknown Source)
        - locked <0x05bb7d48> (a java.lang.Object)
        at com.sun.media.sound.DirectAudioDevice$DirectClip.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

        "InvalQueue-1-com.pogo.ui2.awt.BufferedPanel[panel2,0,0,564x506,invalid]" daemon prio=4 tid=0x0e31af10 nid=0x2618 in Object.wait() [0x1198f000..0x1198fbe8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05bc78e8> (a java.util.Vector)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.ui2.awt.InvalQueue.run(BufferedPanel.java:430)
        - locked <0x05bc78e8> (a java.util.Vector)
        at java.lang.Thread.run(Unknown Source)

        "InvalQueue-1-com.pogo.game.client2.peaks.PeaksGame[panel1,0,0,564x506]" daemon prio=4 tid=0x0e331198 nid=0x1a28 in Object.wait() [0x11a8f000..0x11a8fa68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.ui2.awt.InvalQueue.run(BufferedPanel.java:430)
        - locked <0x05bc7920> (a java.util.Vector)
        at java.lang.Thread.run(Unknown Source)

        "Timer2" daemon prio=4 tid=0x0e32c820 nid=0x15c4 in Object.wait() [0x1188f000..0x1188fce8]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x05a82658> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "Timer2" daemon prio=4 tid=0x0e329498 nid=0x26fc in Object.wait() [0x1168f000..0x1168fc68]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x05a827b8> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "RunnableQueueThread:Thread-1666" prio=4 tid=0x0e32d3f0 nid=0x1034 in Object.wait() [0x1178f000..0x1178fd68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.util.thin.RunnableQueueThread.get(RunnableQueueThread.java:62)
        - locked <0x05a82248> (a com.pogo.ui.anim.AnimationQueue)
        at com.pogo.ui.anim.AnimationQueue.run(AnimationQueue.java:89)
        - locked <0x05a82248> (a com.pogo.ui.anim.AnimationQueue)

        "RunnableQueueThread:Thread-1665" prio=4 tid=0x0e2eb398 nid=0xde8 in Object.wait() [0x1128f000..0x1128fa68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.util.thin.RunnableQueueThread.get(RunnableQueueThread.java:62)
        - locked <0x05a82448> (a com.pogo.ui.anim.AnimationQueue)
        at com.pogo.ui.anim.AnimationQueue.run(AnimationQueue.java:89)
        - locked <0x05a82448> (a com.pogo.ui.anim.AnimationQueue)

        "RunnableQueueThread:Thread-1662" prio=4 tid=0x0e2d4d30 nid=0x1f40 in Object.wait() [0x1158f000..0x1158f9e8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05a825e8> (a com.pogo.ui.anim.AnimationQueue)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.util.thin.RunnableQueueThread.get(RunnableQueueThread.java:62)
        - locked <0x05a825e8> (a com.pogo.ui.anim.AnimationQueue)
        at com.pogo.ui.anim.AnimationQueue.run(AnimationQueue.java:89)
        - locked <0x05a825e8> (a com.pogo.ui.anim.AnimationQueue)

        "RunnableQueueThread:Thread-1660" prio=4 tid=0x0e2d5258 nid=0x1ca4 in Object.wait() [0x1148f000..0x1148fd68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.util.thin.RunnableQueueThread.get(RunnableQueueThread.java:62)
        - locked <0x05a823d8> (a com.pogo.ui.anim.AnimationQueue)
        at com.pogo.ui.anim.AnimationQueue.run(AnimationQueue.java:89)
        - locked <0x05a823d8> (a com.pogo.ui.anim.AnimationQueue)

        "RunnableQueueThread:Thread-1659" prio=4 tid=0x0e36cb38 nid=0x164 in Object.wait() [0x1108f000..0x1108fae8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05a82578> (a com.pogo.ui.anim.AnimationQueue)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.util.thin.RunnableQueueThread.get(RunnableQueueThread.java:62)
        - locked <0x05a82578> (a com.pogo.ui.anim.AnimationQueue)
        at com.pogo.ui.anim.AnimationQueue.run(AnimationQueue.java:89)
        - locked <0x05a82578> (a com.pogo.ui.anim.AnimationQueue)

        "RunnableQueueThread:Thread-1656" prio=4 tid=0x0e339518 nid=0x2244 in Object.wait() [0x1138f000..0x1138fc68]
        at java.lang.Object.wait(Native Method)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.util.thin.RunnableQueueThread.get(RunnableQueueThread.java:62)
        - locked <0x05a821d8> (a com.pogo.ui.anim.AnimationQueue)
        at com.pogo.ui.anim.AnimationQueue.run(AnimationQueue.java:89)
        - locked <0x05a821d8> (a com.pogo.ui.anim.AnimationQueue)

        "ScrollingLabel" daemon prio=4 tid=0x0e339af0 nid=0x348 in Object.wait() [0x1118f000..0x1118fb68]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x05a82918> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "ScrollingLabel" daemon prio=4 tid=0x0e2eaa00 nid=0x2114 in Object.wait() [0x10f8f000..0x10f8fbe8]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x05a82a78> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "Tokens" prio=4 tid=0x0e1a4300 nid=0x1478 in Object.wait() [0x10d8f000..0x10d8fb68]
        at java.lang.Object.wait(Native Method)
        at com.pogo.game.client2.peaks.Tokens.p_doWait(Tokens.java:146)
        - locked <0x05a82bd8> (a com.pogo.game.client2.peaks.Tokens)
        at com.pogo.game.client2.peaks.Tokens.run(Tokens.java:97)
        at java.lang.Thread.run(Unknown Source)

        "Tokens" prio=4 tid=0x0e30bc20 nid=0x214 in Object.wait() [0x10e8f000..0x10e8fc68]
        at java.lang.Object.wait(Native Method)
        at com.pogo.game.client2.peaks.Tokens.p_doWait(Tokens.java:146)
        - locked <0x05a70570> (a com.pogo.game.client2.peaks.Tokens)
        at com.pogo.game.client2.peaks.Tokens.run(Tokens.java:97)
        at java.lang.Thread.run(Unknown Source)

        "StreakMeter" prio=4 tid=0x0e30c7f8 nid=0x27b4 in Object.wait() [0x10b8f000..0x10b8fa68]
        at java.lang.Object.wait(Native Method)
        at com.pogo.game.client2.peaks.StreakMeter.p_doWait(StreakMeter.java:226)
        - locked <0x05a70730> (a com.pogo.game.client2.peaks.StreakMeter)
        at com.pogo.game.client2.peaks.StreakMeter.run(StreakMeter.java:178)
        at java.lang.Thread.run(Unknown Source)

        "ITimer" daemon prio=4 tid=0x0e2f6d50 nid=0x1a08 in Object.wait() [0x10c8f000..0x10c8fbe8]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x05a05278> (a com.pogo.ui2.awt.Timer)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.ui2.awt.Timer.run(Timer.java:95)
        - locked <0x05a05278> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "JTimer" daemon prio=4 tid=0x0e2fcc48 nid=0x10c4 in Object.wait() [0x1090f000..0x1090fae8]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x05a053d8> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "TextField" daemon prio=4 tid=0x02549b60 nid=0x2130 in Object.wait() [0x1050f000..0x1050fd68]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x0595ae00> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "ScrollBar" daemon prio=4 tid=0x0e1a50a0 nid=0x1868 in Object.wait() [0x10a0f000..0x10a0fce8]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x0595af60> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "ScrollBar" daemon prio=4 tid=0x02436038 nid=0x1a00 in Object.wait() [0x0f45f000..0x0f45fb68]
        at java.lang.Object.wait(Native Method)
        at com.pogo.ui2.awt.Timer.run(Timer.java:81)
        - locked <0x0595b0c0> (a com.pogo.ui2.awt.Timer)
        at java.lang.Thread.run(Unknown Source)

        "EmoticonAnimThread" prio=4 tid=0x0e251af8 nid=0x1a50 in Object.wait() [0x1040f000..0x1040fd68]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x0595b220> (a java.util.Vector)
        at java.lang.Object.wait(Unknown Source)
        at com.pogo.game.client2.chat.EmoticonManager.run(EmoticonManager.java:188)
        - locked <0x0595b220> (a java.util.Vector)
        at java.lang.Thread.run(Unknown Source)
        ----------------------------------------------------
        Done.


        REPRODUCIBILITY :
        This bug can be reproduced often.

        ---------- BEGIN SOURCE ----------

        public class SoundApplet extends java.applet.Applet implements Runnable {
        public void start() {
        new Thread(this, "SoundApplet").start();
        }

        int i = 0;

        public void run() {
        // You can download this sound from http://www.pogo.com/applet/sounds/aces/ac_newranktheme.au
        URL urlA = this.getClass().getResource("ac_newranktheme.au");
        System.out.println("URLA:" + urlA.toString());
        AudioClip ac = getAudioClip(urlA);
        try {
        while (true) {
        ac.loop();
        delay(1000);

        ac.stop();
        delay(1000);

        System.out.println("loop " + i);
        i++;
        repaint();
        }
        } catch (Exception e) {
        e.printStackTrace();
        } finally {
        ac.stop();
        }

        }

        private void delay(int millis) {
        try {
        Thread.sleep(millis);
        } catch (InterruptedException e) {}
        }

        public void paint(Graphics g) {
        g.drawString("loop " + i, 0, 10);
        }
        }
        ---------- END SOURCE ----------
        ###@###.### 2005-05-13 04:49:37 GMT

              amenkov Alex Menkov
              jssunw Jitender S (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: