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

Race conditions in Regression-test PropertyChangeSupport/4682386/TestMain.java

XMLWordPrintable

    • tiger
    • x86
    • solaris_9
    • Verified



      Name: vsR10238 Date: 08/05/2003


      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.5.0-b13
      Testbase : Regression-test
      Platform[s] : Solaris 9 (x86) (CDE)
      switch/Mode : -server
      Falling test[s]:
                java/beans/PropertyChangeSupport/4682386/TestMain.java

      Regression-test java/beans/PropertyChangeSupport/4682386/TestMain.java test fails because of
      race conditions:

      bean.setFoo(!bean.isFoo()) in PropertyThread is executed before
      bean.addPropertyChangeListener(new PropertyHandler()) in AddThread and
      support occures to be null in setFoo.

      After I had modified testThreading() as follows, the test passed.

            public void testThreading() {
                bean = new TestBean();

                Thread add = new AddThread();
                Thread remove = new RemoveThread();
                Thread prop = new PropertyThread();

                add.start();
                try{ Thread.sleep(100); }catch(Exception e){}
                prop.start();
                remove.start();
            }

      Test source location:
      =====================
      /java/re/jdk/1.5.0/promoted/latest/ws/j2se/test/java/beans/PropertyChangeSupport/4682386/TestMain.java

      jtr file location:
      ==================
      /net/jtgb4u4c.sfbay/export/sail15/results.2/tiger/b13/regtest/x86/sol9_x86_cde_smp_linux-6/workDir/test/java/beans/PropertyChangeSupport/4682386/TestMain.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
      JT_HOME="/net/linux-15/export/home/java/jct"
      JAVA_HOME="/net/linux-15/export/home/java/jdk1.5.0/x86"
      TEST_BASE_PATH="/net/linux-15/export/home/java/regtest/test"

      TESTWITH=$JAVA_HOME
      TESTJAVA=$JAVA_HOME

      JTOPTS="-server"
      TESTVMOPTS="-server"

      CLASSPATH="$JT_HOME/classes:$JT_HOME/lib/javatest.jar:$JT_HOME/lib/jtreg.jar:$JT_HOME/jemmy/jemmy.jar"

      export JAVA_HOME
      export JT_HOME
      export TESTWITH
      export CLASSPATH

      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 -cp $CLASSPATH $JTOPTS -DenvVars=TESTJAVAHOME=$JAVA_HOME,TESTVMOPTS=$TESTVMOPTS,DISPLAY=:0,HOME=$HOME/.regtest,PATH=/bin:/usr/bin,CPAPPEND=$JT_HOME/jemmy/jemmy.jar,TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= -DDISPLAY=:0 -DlocalHost="linux-6" -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/java/beans/PropertyChangeSupport/4682386/TestMain.java"

      --- script end ---

      Script output:
      ==============

      Test output (jtr part):
      =======================
      ----------System.out:(1/21)----------
      Exec time (ms): 2927
      ----------System.err:(19/624)----------
      Graphics(0-1) Enabling debug
      Graphics(1-1) Enabling debug
      Graphics(2-1) Enabling debug
      Graphics(3-1) Enabling debug
      Graphics(4-1) Enabling debug
      Graphics(5-1) Enabling debug
      Graphics(6-1) Enabling debug
      Graphics(7-1) Enabling debug
      Graphics(8-1) Enabling debug
      Graphics(9-1) Enabling debug
      Graphics(10-1) Enabling debug
      Graphics(11-1) Enabling debug
      Graphics(12-1) Enabling debug
      Graphics(13-1) Enabling debug
      STATUS:Passed.
      java.lang.NullPointerException
      at TestMain$TestBean.setFoo(TestMain.java:253)
      at TestMain$PropertyThread.run(TestMain.java:108)
      STATUS:Failed.`main' threw exception: java.lang.NullPointerException
      result: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException


      test result: Failed. Execution failed: `main' threw exception: java.lang.NullPointerException


      Specific machine info:
      ======================
      Hostname: linux-6
      OS: Solaris 9 (x86) (CDE)



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

            mdavidsosunw Mark Davidson (Inactive)
            vshsunw Vsh Vsh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: