5292N/A#
5292N/A# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
5292N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5292N/A#
5292N/A# This code is free software; you can redistribute it and/or modify it
5292N/A# under the terms of the GNU General Public License version 2 only, as
5292N/A# published by the Free Software Foundation.
5292N/A#
5292N/A# This code is distributed in the hope that it will be useful, but WITHOUT
5292N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5292N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5292N/A# version 2 for more details (a copy is included in the LICENSE file that
5292N/A# accompanied this code).
5292N/A#
5292N/A# You should have received a copy of the GNU General Public License version
5292N/A# 2 along with this work; if not, write to the Free Software Foundation,
5292N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5292N/A#
5292N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5292N/A# or visit www.oracle.com if you need additional information or have any
5292N/A# questions.
5292N/A#
5292N/A
5292N/A#
5292N/A# @test
5292N/A# @bug 7056731
5292N/A# @summary Race condition in CORBA code causes re-use of ABORTed connections
5292N/A#
5292N/A# @run shell 7056731.sh
5292N/A#
5292N/A
5292N/AOS=`uname -s`
5292N/Acase "$OS" in
5292N/A SunOS | Linux | Darwin )
5292N/A PS=":"
5292N/A FS="/"
5292N/A ;;
5292N/A Windows* | CYGWIN* )
5292N/A PS=";"
5292N/A FS="\\"
5292N/A ;;
5292N/A * )
5292N/A echo "Unrecognized system!"
5292N/A exit 1;
5292N/A ;;
5292N/Aesac
5292N/A
5292N/Aif [ "${TESTJAVA}" = "" ] ; then
5292N/A echo "TESTJAVA not set. Test cannot execute. Failed."
5292N/A exit 1
5292N/Afi
5292N/A
5292N/AJAVA="${TESTJAVA}${FS}bin${FS}java"
5292N/APORT=1052
5292N/Acp -r ${TESTSRC}${FS}*.java ${TESTSRC}${FS}Hello.idl .
5292N/Aecho "Testing...please wait"
5292N/A
5292N/A${TESTJAVA}${FS}bin${FS}idlj -fall Hello.idl
5292N/A${TESTJAVA}${FS}bin${FS}javac *.java HelloApp/*.java
5292N/A
5292N/Aecho "starting orbd"
5292N/A${TESTJAVA}${FS}bin${FS}orbd -ORBInitialPort $PORT -ORBInitialHost localhost &
5292N/AORB_PROC=$!
5292N/Asleep 2 #give orbd time to start
5292N/Aecho "started orb"
5292N/Aecho "starting server"
5292N/A${TESTJAVA}${FS}bin${FS}java -cp . HelloServer -ORBInitialPort $PORT -ORBInitialHost localhost &
5292N/ASERVER_PROC=$!
5292N/Asleep 2 #give server time to start
5292N/Aecho "started server"
5292N/Aecho "starting client (debug mode)"
5292N/A${TESTJAVA}${FS}bin${FS}java -cp . -agentlib:jdwp=transport=dt_socket,server=y,address=8000 HelloClient -ORBInitialPort $PORT -ORBInitialHost localhost > client.$$ 2>&1 &
5292N/AJVM_PROC=$!
5292N/Asleep 2 #give jvm/debugger/client time to start
5292N/A
5292N/Aecho "started client (debug mode)"
5292N/Aecho "starting debugger and issuing commands"
5292N/A(sleep 2;
5292N/Aecho "stop in com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.unregisterWaiter";
5292N/Asleep 2;
5292N/Aecho "run";
5292N/Asleep 2;
5292N/Aecho "cont";
5292N/Asleep 2;
5292N/Aecho "cont";
5292N/Asleep 2;
5292N/Aecho "cont";
5292N/Asleep 2;
5292N/Aecho "suspend 1";
5292N/Asleep 2;
5292N/Akill -9 $SERVER_PROC &> /dev/null;
5292N/Asleep 2;
5292N/Aecho "cont";
5292N/Asleep 2;
5292N/Aecho "thread 1"
5292N/Asleep 2;
5292N/Aecho "clear com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.unregisterWaiter"
5292N/Asleep 2;
5292N/Aecho "resume 1";
5292N/A)| ${TESTJAVA}${FS}bin${FS}jdb -connect com.sun.jdi.SocketAttach:hostname=localhost,port=8000
5292N/A
5292N/Asleep 5 # give time for Client to throw exception
5292N/A
5292N/A# JVM_PROC should have exited but just in case, include it.
5292N/Akill -9 $ORB_PROC $JVM_PROC
5292N/A
5292N/Agrep "ORBUtilSystemException.writeErrorSend" client.$$
5292N/Aresult=$?
5292N/Aif [ $result -eq 0 ]
5292N/Athen
5292N/A echo "Failed"
5292N/A exitCode=1;
5292N/Aelse
5292N/A echo "Passed"
5292N/A exitCode=0
5292N/Afi
5292N/A
5292N/A#jtreg complaining about not being able to clean up; let's sleep
5292N/Asleep 2
5294N/Arm -rf out.$$ client.$$
5294N/Asleep 2
5294N/Aexit ${exitCode}