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

TEST_BUG: Reg.test: race condition in ShellScaffold.sh

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b11
    • CPU:
      x86
    • OS:
      windows
    • Verification:
      Verified

      Description



      Name: asR10013 Date: 11/28/2002


      Filed By : J2SE-SQA [###@###.###
      JDK : JDK1.4.2-b08
      Testbase : RegTest-test
      Platform[s] : Windows
      switch/Mode : -client
      Falling test[s]:
              com/sun/jdi/GetLocalVariables4Test.sh

      RegTest-test com/sun/jdi/GetLocalVariables4Test.sh test fails intermittently.
      The cause of the problem is that there is a dangerous code in ShellScaffold.sh that
      can lead to race conditions:

              if [ -r $jdbOutFile ] ; then
                  # Something here causes jdb to complain about Unrecognized cmd on x86.
                  tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
                  if [ $? = 0 ] ; then
                      break
                  fi
              fi
              tail -2 $jdbOutFile | $grep -s "The application exited" > $devnull 2>&1
              if [ $? = 0 ] ; then
                  dofail "Waited for jdb msg $1, but it never appeared"
              fi

      The expected output can appear after
      tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
      and before
      tail -2 $jdbOutFile | $grep -s "The application exited" > $devnull 2>&1

      Actually it seems to happen quite often on my Windows ME machine.

      After I had changed the code as follows:

              if [ -r $jdbOutFile ] ; then
                  # Something here causes jdb to complain about Unrecognized cmd on x86.
                  tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
                  if [ $? = 0 ] ; then
                      break
                  fi
              fi
              tail -2 $jdbOutFile | $grep -s "The application exited" > $devnull 2>&1
              if [ $? = 0 ] ; then

                  if [ -r $jdbOutFile ] ; then
                      tail -$nlines $jdbOutFile | $grep -s "$1" > $devnull 2>&1
                      if [ $? = 0 ] ; then
                          break
                      fi
                  fi

                  dofail "Waited for jdb msg $1, but it never appeared"
              fi

      the test passed 5 times of 5.

      Please note that the test also fails due to bug 4786183 on Windows ME.

      Test source location:
      =====================
      /java/re/jdk/1.4.2/promoted/latest/ws/j2se/test/com/sun/jdi/GetLocalVariables4Test.sh

      jtr file location:
      ==================
      /net/jtgb4u4c.sfbay/export/sail15/results/mantis/b08/regtest/win32/winme_-client_linux-18/workDir/test/com/sun/jdi/GetLocalVariables4Test.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="h:/java/jct"
      JAVA_HOME="h:/java/jdk1.4.2/win32"
      TEST_BASE_PATH="h:/java/regtest/test"

      TESTWITH=$JAVA_HOME
      TESTJAVA=$JAVA_HOME

      JTOPTS="-client"
      TESTVMOPTS="-client"

      CLASSPATH="$JT_HOME/classes;$JT_HOME/lib/javatest.jar;$JT_HOME/lib/jtreg.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,windir=$windir,PATH=${SHELL%/*},TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= -DDISPLAY=:0 -DlocalHost="linux-18" -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/com/sun/jdi/GetLocalVariables4Test.sh"

      --- script end ---


      test result: Failed. Execution failed: exit code 1


      Specific machine info:
      ======================
      Hostname: linux-18
      OS: Windows ME



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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              alanb Alan Bateman
              Reporter:
              alssunw Als Als (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: