JDK-4961343 : TEST_BUG: Regression-test javax/sound/sampled/Clip/ClipFlushCrash.java fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2003-12-01
  • Updated: 2004-03-31
  • Resolved: 2003-12-01
Related Reports
Duplicate :  
Description

Name: iaR10016			Date: 12/01/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b29, JDK1.5.0-b29
                  (this is a new test which is absent in previous JDK builds)
Testbase       : Regression-test
Platform[s]    : Suse Linux 8.2 (GNOME2)
switch/Mode    : -client
Falling test[s]: javax/sound/sampled/Clip/ClipFlushCrash.java

Regression-test javax/sound/sampled/Clip/ClipFlushCrash.java test fails with timeout
using JDK1.5.0-b29.

It seems like the test fails because of synchronization problems:

Here is the test source fragment:

--------- ClipFlushCrash.java ---------
...
     68            AT at4 = new AT(clip, "open/close thread", 600) {
     69            public synchronized void doAction() throws Exception {
     70                log("close");
     71                clip.close();
     72                wait(50);
     73                if (!terminated) {
     74                    log("open");
     75                    bais.reset();
     76                    clip.open(new AudioInputStream(bais, format, frameCount));
     77                }
     78            }
     79            };
     80
     81            out(" clip.start");
     82            clip.start();
     83            out(" for 10 seconds, call start/stop, setFramePosition, and flush from other threads");
     84            at1.start();
     85            at2.start();
     86            at3.start();
     87            at4.start();
     88            try {
     89                Thread.sleep(10000);
     90            } catch (InterruptedException ie) {}
     91            out(" finished.");
     92            at1.terminate();
     93            at2.terminate();
     94            at3.terminate();
     95            at4.terminate();
     96            out(" clip.close()");
     97            clip.close();
     98            success++;
...
---------------------------------------

Problem is that at4 can be closed when the main thread tries to terminate it, so the test hangs
at the line 95 and never finishes.

The test stable passes if I increase waiting time at the line 72:
...
     72                wait(10000);
...

Test source location:
=====================
/java/re/jdk/1.5.0/promoted/latest/ws/j2se/test/javax/sound/sampled/Clip/ClipFlushCrash.java

jtr file location:
==================
/net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b29/regtest/linux/suse8.2_gnome_linux-2/workDir/test/javax/sound/sampled/Clip/ClipFlushCrash.jtr

How to reproduce:
=================
Run the following script (you may need to change its variables):
--- script start ---
#!/bin/sh
RESULT_DIR=`pwd`
WORK_DIR=$RESULT_DIR/workDir/test
REPORT_DIR=$RESULT_DIR/reportDir

#Paths in Java Software:
JT_HOME="/java/re/jct-tools/3.1.2/archive/fcs/binaries"
JEMMY_JAR="/net/jdk/export/jpse04/Jemmy/jemmy.jar"
JAVA_HOME="/java/re/jdk/1.5.0/promoted/all/b29/binaries/linux-i586"
TEST_BASE_PATH="/java/re/jdk/1.5.0/promoted/all/b29/ws/j2se/test"

#Alternative paths outside Java Software:
#JT_HOME="/net/koori.sfbay/onestop/jct-tools/3.1.2/archive/fcs/binaries"
#JEMMY_JAR="/net/jdk/export/jpse04/Jemmy/jemmy.jar"
#JAVA_HOME="/net/koori.sfbay/onestop/jdk/1.5.0/promoted/all/b29/binaries/linux-i586"
#TEST_BASE_PATH="/net/koori.sfbay/onestop/jdk/1.5.0/promoted/all/b29/ws/j2se/test"

TESTVMOPTS="-client"
CLASSPATH="$JT_HOME/classes:$JT_HOME/lib/javatest.jar:$JT_HOME/lib/jtreg.jar"
TEST="javax/sound/sampled/Clip/ClipFlushCrash.java"

mkdir -p $WORK_DIR/scratch 2>&1
mkdir -p $WORK_DIR/jtData 2>&1
mkdir -p $REPORT_DIR 2>&1
#rm $WORK_DIR/jtData/ResultCache.jtw 2>&1
cd $WORK_DIR/scratch

$JAVA_HOME/bin/java -server -cp $CLASSPATH -DenvVars=TESTJAVAHOME=$JAVA_HOME,TESTVMOPTS=$TESTVMOPTS,DISPLAY=:0,HOME=$HOME/.regtest,PATH=/bin:/usr/bin,CPAPPEND=$JEMMY_JAR,TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= -DDISPLAY=:0 -DlocalHost="linux-2" -Dprogram=jtreg com.sun.javatest.regtest.Main -a -v default -batch -params -w "$WORK_DIR" -r "$REPORT_DIR" -t "$TEST_BASE_PATH" "$TEST_BASE_PATH/$TEST"
--- script end ---

Test output (jtr part):
=======================
----------System.out:(26/927)----------
Using default mixer
  got clip: com.sun.media.sound.MixerClip@665753
  no direct audio clip -> do not test.
Using mixer: com.sun.media.sound.DirectAudioDevice@ef22f8
  got clip: com.sun.media.sound.DirectAudioDevice$DirectClip@17ace8d
  open
  clip.start
  for 10 seconds, call start/stop, setFramePosition, and flush from other threads
    flush thread: start
    start/stop thread: start
    setFramePosition thread: start
    open/close thread: start
    setFramePosition thread: setPosition to frame 40306
    flush thread: flush
    setFramePosition thread: setPosition to frame 404637
    setFramePosition thread: setPosition to frame 393964
    flush thread: flush
    start/stop thread: stop
    setFramePosition thread: setPosition to frame 340047
    flush thread: flush
    open/close thread: close
    start/stop thread: start
  finished.
    flush thread: terminate
    setFramePosition thread: terminate
    start/stop thread: terminate
----------System.err:(0/0)----------
result: Failed. Execution failed: Program `/net/linux-15/export/home/java/jdk1.5.0/linux.shared/bin/java' interrupted! (timed out?)

test result: Failed. Execution failed: Program `/net/linux-15/export/home/java/jdk1.5.0/linux.shared/bin/java' interrupted! (timed out?)

Specific machine info:
======================
Hostname: linux-2
OS: Suse Linux 8.2 (GNOME2)

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values VERIFIED IN: tiger-beta2
14-06-2004

EVALUATION I think that this is not only a synchronization problem in the test case -- I could only produce this problem on Linux. ###@###.### 2003-12-01
01-12-2003