diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2014-08-01 21:07:34 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2014-08-01 21:07:34 +0000 |
commit | fcc9927e22522ad895e0bfe007c5339e94f2631e (patch) | |
tree | 06493e92480ca32b5036b5e5de7a294153426dd2 /TAO/orbsvcs/tests/ImplRepo/double_start | |
parent | 213b746a9f1c8ff75b8c387dd3802d2308960230 (diff) | |
download | ATCD-fcc9927e22522ad895e0bfe007c5339e94f2631e.tar.gz |
Fri Aug 1 21:01:55 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
* orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp:
* orbsvcs/ImplRepo_Service/ImR_Activator_i.h:
* orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp:
* orbsvcs/ImplRepo_Service/ImR_Locator.idl:
Address potential race conditions when server starts are
requested via both the primary and backup ImRs.
* orbsvcs/tests/ImplRepo/double_start/client.cpp:
* orbsvcs/tests/ImplRepo/double_start/restart.sh:
* orbsvcs/tests/ImplRepo/double_start/run_test.pl:
* orbsvcs/tests/ImplRepo/double_start/server.cpp:
Refactor the kill test so that it better matches the original
complaint.
Diffstat (limited to 'TAO/orbsvcs/tests/ImplRepo/double_start')
-rw-r--r-- | TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp | 25 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/double_start/restart.sh | 10 | ||||
-rwxr-xr-x | TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl | 57 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp | 12 |
4 files changed, 69 insertions, 35 deletions
diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp b/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp index 844db30bfe0..e1568cd4dba 100644 --- a/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/double_start/client.cpp @@ -87,23 +87,28 @@ do_restart_test (void) obj = set_timeout_policy (obj.in (), ACE_Time_Value (5,0)); Test_var test = Test::_narrow( obj.in () ); ACE_ASSERT (!CORBA::is_nil(test.in ())); - - try + int attempt = 2; + while (attempt > 0) { - test->arm (); - } - catch (const CORBA::Exception& ex) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("client caught %C during arm\n"), - ex._name ())); - return; + try + { + test->arm (); + attempt = 0; + } + catch (const CORBA::Exception& ex) + { + attempt--; + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("client caught %C during arm, retrying\n"), + ex._name ())); + } } ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("client sleeping %d seconds\n"), request_delay_secs)); ACE_OS::sleep (request_delay_secs); + try { test->trigger (); diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/restart.sh b/TAO/orbsvcs/tests/ImplRepo/double_start/restart.sh index 2098e3a1eae..4fb892211c4 100755 --- a/TAO/orbsvcs/tests/ImplRepo/double_start/restart.sh +++ b/TAO/orbsvcs/tests/ImplRepo/double_start/restart.sh @@ -39,22 +39,22 @@ if [ 0 -ne $reset_flag ]; then # tao_imr shutdown $server_name # status=$? # echo shutdown returned $status - echo restart: calling tao_imr start + echo restart $$: calling tao_imr start tao_imr start $server_name status=$? - echo restart: tao_imr start returned $status + echo restart $$: tao_imr start returned $status exit; fi fi -echo restart: running $exec_cmd +echo restart $$: running $exec_cmd $exec_cmd & exec_cmd_pid=$! -echo "restart: pid is $exec_cmd_pid, waiting" +echo "restart $$: pid is $exec_cmd_pid, waiting" wait $exec_cmd_pid exec_cmd_status=$? -echo "restart: status is $exec_cmd_status" +echo "restart $$: status is $exec_cmd_status" if [[ 0 != $exec_cmd_status ]]; then ./restart.sh -e "$exec_cmd" -c $use_imr -p $$ -r 1 -s $server_name & diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl index 7e26c0e81f5..e0fcc864a6a 100755 --- a/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl +++ b/TAO/orbsvcs/tests/ImplRepo/double_start/run_test.pl @@ -12,6 +12,7 @@ use PerlACE::TestTarget; $status = 0; $debuglevel = 0; $cltdbg = 1; +$cltpause = 0; $kill = 0; $server_pid = 0; @@ -26,6 +27,7 @@ if ($#ARGV >= 0) { } elsif ($ARGV[$i] eq '-kill') { $kill = 1; + $cltpause = 5; } else { usage(); @@ -201,7 +203,9 @@ sub get_server_pid my $pid = 0; open (FILE, "server.pid") or die "Can't open server.pid: $!"; while (<FILE>) { - $pid = $_; + chomp; + $pid = $_; + $server_pid = $pid if ($server_pid == 0); } close FILE; return $pid; @@ -210,7 +214,6 @@ sub get_server_pid sub signal_server { my $sig = shift; - $server_pid = get_server_pid () if ($server_pid == 0); print "signal $sig to server $server_pid\n"; kill ($sig, $server_pid); } @@ -220,8 +223,7 @@ sub start_imr my $all = shift; my $debugbase = "-ORBDebugLevel $debuglevel " . "-ORBVerboseLogging 1 -ORBLogFile "; - my $actargs = "-l -o $act_actiorfile $act_initref -ORBListenEndpoints iiop://127.0.0.1: -"; + my $actargs = "-d $debuglevel -l -o $act_actiorfile $act_initref -ORBListenEndpoints iiop://127.0.0.1:"; my $imrargs = " -d $debuglevel -i -v 1000 " . "--directory . --primary " . @@ -307,7 +309,7 @@ sub start_imr } } -sub run_client +sub launch_client { if ($srv->GetFile ($srviorfile) == -1) { print STDERR "ERROR: cannot retrieve file <$srv_srviorfile>\n"; @@ -318,16 +320,27 @@ sub run_client return 1; } - my $args = "-k file://$srviorfile -ORBSvcConf clt.conf"; + my $args = "-k file://$srviorfile -ORBSvcConf clt.conf -d $cltpause"; $args .= " -ORBDebuglevel $cltdbg -ORBVerboseLogging 1 -ORBLogFile $cltlogfile" if ($debuglevel > 0); print "running client $args\n"; $CLT->Arguments ($args); - if ($CLT->SpawnWaitKill ($clt->ProcessStartWaitInterval() + 120) == -1) { + if ($CLT->Spawn () == -1) { print STDERR "ERROR: client failed\n"; return 1; } + return 0; +} + +sub run_client +{ + if (launch_client () == 0) { + if ($CLT->WaitKill ($clt->ProcessStartWaitInterval() + 120) == -1) { + print STDERR "ERROR: client failed\n"; + return 1; + } + } } sub do_ti_command @@ -342,7 +355,7 @@ sub do_ti_command print "invoking ti cmd $cmd $obj_name $cmdargs\n" if ($debuglevel > 0); $TI->Arguments ("$ti_initref $cmd $obj_name $cmdargs"); $TI_status = $TI->SpawnWaitKill ($ti->ProcessStartWaitInterval()); - if ($TI_status != 0) { + if ($TI_status != 0 && $TI_status != 5) { return kill_imr ("tao_imr $cmd $obj_name returned $TI_status"); } } @@ -375,7 +388,7 @@ sub list_active_servers sub kill_primary_test { print "Running double server start test killing the primary ImR.\n"; - + unlink "server.pid"; my $result = 0; my $start_time = time(); @@ -394,23 +407,35 @@ sub kill_primary_test if (do_ti_command ("start") != 0) { return 1; } + my $firstpid = get_server_pid (); + print "first pid = $firstpid, server pid = $server_pid\n"; - list_active_servers ("-v"); + print "starting client\n"; + if (launch_client () != 0) { + return 1; + } + sleep 2; signal_server ("STOP"); kill_primary (); - sleep 2; + sleep 4; + start_imr (0); - sleep 2; - print "starting client\n"; - if (run_client () != 0) { + signal_server ("KILL"); + unlink "server.pid"; + $server_pid = 0; + + print "******waiting for client exit\n"; + if ($CLT->WaitKill ($clt->ProcessStartWaitInterval() + 120) == -1) { + print STDERR "ERROR: client failed\n"; return 1; } + print "******client done\n"; - signal_server ("CONT"); - + sleep 4; my $final_pid = get_server_pid (); + print "first server pid was $server_pid, but now there is $final_pid\n"; if ($final_pid != $server_pid) { print "first server pid was $server_pid, but now there is $final_pid\n"; $server_pid = $final_pid; diff --git a/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp b/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp index 7252db67e82..b6d02da96ea 100644 --- a/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp +++ b/TAO/orbsvcs/tests/ImplRepo/double_start/server.cpp @@ -146,14 +146,18 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) mgr->activate(); ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("Started Server <%C>\n"), - poa_name.c_str())); + ACE_TEXT ("Started Server <%C> pid = %d\n"), + poa_name.c_str(), ACE_OS::getpid ())); ACE_CString pid_file = "server.pid"; { - ofstream out(pid_file.c_str ()); + ofstream out(pid_file.c_str (), ios_base::app); out << ACE_OS::getpid () << endl; + out.close (); } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("Server <%C> pid = %d closed pidfile\n"), + poa_name.c_str(), ACE_OS::getpid ())); if (max_run > 0) { @@ -168,7 +172,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) root_poa->destroy(1,1); orb->destroy(); - ACE_OS::unlink (pid_file.c_str ()); + // ACE_OS::unlink (pid_file.c_str ()); } catch(const CORBA::Exception& ex) { |