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

Two "Direct Clip" threads are created to play the same "AudioClip" object, what makes clip sound corrupted

    XMLWordPrintable

Details

    • b155
    • generic
    • windows

    Backports

      Description

        FULL PRODUCT VERSION :
        64-bit JDK 8u112 b15, 64-bit JDK 9 b145

        ADDITIONAL OS VERSION INFORMATION :
        64-bit MS Windows 7 OS

        A DESCRIPTION OF THE PROBLEM :
        After many repetitive sequential calls to the methods "loop()", "stop()" on the same instance of "java.applet.AudioClip" at some moment two threads with the name "Direct Clip", which are responsible for background playing of the mentioned "AudioClip" instance, are created and start existing in parallel, what makes the being played clip sound as corrupted.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        The bug is intermittent and can be reproduced with both 64-bit and 32-bit JDK using 2 test cases:
        - The attached "TestCase2.zip" – it may take 12 minutes to reproduce.
        - The attached "AC.java" (requires additional changes), "Windows Logon Sound.wav" – it may take hours to reproduce.

        Using the test case "TestCase2.zip":
        1. Decompress the attached test case "TestCase2.zip".
        2. Start command line "cmd.exe" and change a current directory to the extracted "TestCase2" directory.
        3. Compile and run the extracted test case "TestCase2.java". It may take 12 minutes to reproduce the bug. The bug is reproduced, if call stacks of 2 existing threads with "Direct Clip" name become printed out in the command line, for example:

        -------------------- Example test case output in the command line --------------------
        [Thread[Direct Clip,6,main]], thread.getId()='46'
                        at java.base@9-internal/java.lang.Object.wait(Native Method)
                        at java.desktop@9-internal/com.sun.media.sound.DirectAudioDevice$DirectDL.write(DirectAudioDevice.java:763)
                        at java.desktop@9-internal/com.sun.media.sound.DirectAudioDevice$DirectClip.run(DirectAudioDevice.java:1374)
                        at java.base@9-internal/java.lang.Thread.run(Thread.java:844)

        [Thread[Direct Clip,6,main]], thread.getId()='45'
                        at java.base@9-internal/java.lang.Object.wait(Native Method)
                        at java.desktop@9-internal/com.sun.media.sound.DirectAudioDevice$DirectDL.write(DirectAudioDevice.java:763)
                        at java.desktop@9-internal/com.sun.media.sound.DirectAudioDevice$DirectClip.run(DirectAudioDevice.java:1374)
                        at java.base@9-internal/java.lang.Thread.run(Thread.java:844)
        ----------------------------------------

        Attachments

          1. AC.java
            0.9 kB
          2. TestCase2.zip
            394 kB
          3. Windows Logon Sound.wav
            154 kB

          Issue Links

            Activity

              People

                alitvinov Anton Litvinov (Inactive)
                shadowbug Shadow Bug
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: