summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-09 13:11:43 +0000
committersma <sma@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-09 13:11:43 +0000
commit423d02ce2bd846fe4807f72f53ea897ffe7d1315 (patch)
tree7fe49a4edac07550e96b36e1caea242ce43011a1
parent52ed9a15704e956d7d3fa64c73f3e6a076176a80 (diff)
downloadATCD-423d02ce2bd846fe4807f72f53ea897ffe7d1315.tar.gz
ChangeLogTag: Thu Jul 09 13:10:00 UTC 2009 Simon Massey <sma@prismtech.com>
-rw-r--r--TAO/ChangeLog15
-rw-r--r--TAO/bin/tao_orb_tests.lst1
-rw-r--r--TAO/tao/Invocation_Adapter.cpp15
-rw-r--r--TAO/tests/Bug_3333_Regression/Bug3333.mpc39
-rw-r--r--TAO/tests/Bug_3333_Regression/Hello.cpp23
-rw-r--r--TAO/tests/Bug_3333_Regression/Hello.h31
-rw-r--r--TAO/tests/Bug_3333_Regression/README24
-rw-r--r--TAO/tests/Bug_3333_Regression/Test.idl20
-rw-r--r--TAO/tests/Bug_3333_Regression/client.cpp140
-rwxr-xr-xTAO/tests/Bug_3333_Regression/run_test.pl65
-rw-r--r--TAO/tests/Bug_3333_Regression/server.cpp142
11 files changed, 507 insertions, 8 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index b6145a2bbbb..941f5a1b684 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,18 @@
+Thu Jul 09 13:10:00 UTC 2009 Simon Massey <sma@prismtech.com>
+
+ * bin/tao_orb_tests.lst:
+ * tao/Invocation_Adapter.cpp:
+ * tests/Bug_3333_Regression/Bug3333.mpc
+ * tests/Bug_3333_Regression/README
+ * tests/Bug_3333_Regression/Test.idl
+ * tests/Bug_3333_Regression/Hello.h
+ * tests/Bug_3333_Regression/Hello.cpp
+ * tests/Bug_3333_Regression/client.cpp
+ * tests/Bug_3333_Regression/server.cpp
+ * tests/Bug_3333_Regression/run_test.pl
+
+ Fixed bugzilla 3333.
+
Mon Jun 29 15:08:12 UTC 2009 Adam Mitz <mitza@ociweb.com>
* tao/Connection_Handler.cpp:
diff --git a/TAO/bin/tao_orb_tests.lst b/TAO/bin/tao_orb_tests.lst
index ec626b96138..5999c022334 100644
--- a/TAO/bin/tao_orb_tests.lst
+++ b/TAO/bin/tao_orb_tests.lst
@@ -132,6 +132,7 @@ TAO/tests/Bug_3276_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MI
TAO/tests/Bug_3299_Regression/run_test.pl: !MINIMUM !CORBA_E_COMPACT !CORBA_E_MICRO
TAO/tests/Bug_3315_Regression/run_test.pl: !ST
TAO/tests/Bug_3321_Regression/run_test.pl: !ST
+TAO/tests/Bug_3333_Regression/run_test.pl: !MINIMUM
TAO/tests/Bug_3430_Regression/run_test.pl:
TAO/tests/Bug_3470_Regression/run_test.pl:
TAO/tests/Bug_3471_Regression/run_test.pl:
diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp
index cb79b83a2d9..be97899cd77 100644
--- a/TAO/tao/Invocation_Adapter.cpp
+++ b/TAO/tao/Invocation_Adapter.cpp
@@ -66,6 +66,12 @@ namespace TAO
// Initial state
TAO::Invocation_Status status = TAO_INVOKE_START;
+ ACE_Time_Value *max_wait_time = 0;
+ ACE_Time_Value tmp_wait_time = ACE_Time_Value::zero;
+ if (this->get_timeout (stub, tmp_wait_time))
+ {
+ max_wait_time= &tmp_wait_time;
+ }
while (status == TAO_INVOKE_START || status == TAO_INVOKE_RESTART)
{
@@ -83,7 +89,6 @@ namespace TAO
if (strat == TAO_CS_REMOTE_STRATEGY || strat == TAO_CS_LAST)
{
- ACE_Time_Value *max_wait_time = 0;
status =
this->invoke_remote_i (stub,
details,
@@ -221,12 +226,6 @@ namespace TAO
CORBA::Object_var &effective_target,
ACE_Time_Value *&max_wait_time)
{
- ACE_Time_Value tmp_wait_time;
- bool const is_timeout = this->get_timeout (stub, tmp_wait_time);
-
- if (is_timeout)
- max_wait_time = &tmp_wait_time;
-
(void) this->set_response_flags (stub, details);
CORBA::Octet const rflags = details.response_flags ();
@@ -245,7 +244,7 @@ namespace TAO
if (TAO_debug_level)
{
- if (is_timeout && *max_wait_time == ACE_Time_Value::zero)
+ if (max_wait_time && *max_wait_time == ACE_Time_Value::zero)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) - Invocation_Adapter::invoke_remote_i, ")
ACE_TEXT ("max wait time consumed during transport resolution\n")));
diff --git a/TAO/tests/Bug_3333_Regression/Bug3333.mpc b/TAO/tests/Bug_3333_Regression/Bug3333.mpc
new file mode 100644
index 00000000000..cf6897ad73f
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/Bug3333.mpc
@@ -0,0 +1,39 @@
+// -*- MPC -*-
+// $Id$
+
+project(*idl): taoidldefaults {
+ idlflags += -Sp
+ IDL_Files {
+ Test.idl
+ }
+ custom_only = 1
+}
+
+project(*Server): taoserver, iortable {
+ exename = *
+ after += *idl
+ Source_Files {
+ Hello.cpp
+ server.cpp
+ }
+ Source_Files {
+ TestC.cpp
+ TestS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*Client): taoclient, messaging {
+ exename = *
+ after += *idl
+ Source_Files {
+ client.cpp
+ }
+ Source_Files {
+ TestC.cpp
+ }
+ IDL_Files {
+ }
+}
+
diff --git a/TAO/tests/Bug_3333_Regression/Hello.cpp b/TAO/tests/Bug_3333_Regression/Hello.cpp
new file mode 100644
index 00000000000..f6566bfcb23
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/Hello.cpp
@@ -0,0 +1,23 @@
+//
+// $Id$
+//
+#include "Hello.h"
+
+ACE_RCSID(Hello, Hello, "$Id$")
+
+Hello::Hello (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
+{
+}
+
+char *
+Hello::get_string ()
+{
+ return CORBA::string_dup ("Hello there!");
+}
+
+void
+Hello::shutdown ()
+{
+ this->orb_->shutdown (0);
+}
diff --git a/TAO/tests/Bug_3333_Regression/Hello.h b/TAO/tests/Bug_3333_Regression/Hello.h
new file mode 100644
index 00000000000..782b1b2f573
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/Hello.h
@@ -0,0 +1,31 @@
+//
+// $Id$
+//
+
+#ifndef HELLO_H
+#define HELLO_H
+#include /**/ "ace/pre.h"
+
+#include "TestS.h"
+
+/// Implement the Test::Hello interface
+class Hello
+ : public virtual POA_Test::Hello
+{
+public:
+ /// Constructor
+ Hello (CORBA::ORB_ptr orb);
+
+ // = The skeleton methods
+ virtual char * get_string ();
+
+ virtual void shutdown ();
+
+private:
+ /// Use an ORB reference to conver strings to objects and shutdown
+ /// the application.
+ CORBA::ORB_var orb_;
+};
+
+#include /**/ "ace/post.h"
+#endif /* HELLO_H */
diff --git a/TAO/tests/Bug_3333_Regression/README b/TAO/tests/Bug_3333_Regression/README
new file mode 100644
index 00000000000..c4f6160314e
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/README
@@ -0,0 +1,24 @@
+/**
+
+This test checks that any transparent reinvocations in response to
+LOCATION_FORWARD responses to GIOP::Requests are still bounded by the
+Relative Roundtrip timeout set by the user for the entire request.
+
+The server is configured to run in the test script with -ORBCollocation NO
+and -ORBObjRefStyle URL. Both are required for it to work.
+
+It exports two IORs. One is used for control - to shut the server down.
+The other will cause a client narrowing it to enter an endless
+LOCATION_FORWARD loop.
+
+The client sets a Relative Roundtrip Timeout that should end this loop for
+the test to succeed.
+
+Success looks like this:
+
+Test OK - RELATIVE_RT_TIMEOUT ends location forward loop.
+(4232|3077606096) server - event loop finished
+
+... anything else is probably a regression.
+
+*/
diff --git a/TAO/tests/Bug_3333_Regression/Test.idl b/TAO/tests/Bug_3333_Regression/Test.idl
new file mode 100644
index 00000000000..3c0976e106d
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/Test.idl
@@ -0,0 +1,20 @@
+//
+// $Id$
+//
+
+/// Put the interfaces in a module, to avoid global namespace pollution
+module Test
+{
+ /// A very simple interface
+ interface Hello
+ {
+ /// Return a simple string
+ string get_string ();
+
+ /// A method to shutdown the ORB
+ /**
+ * This method is used to simplify the test shutdown process
+ */
+ oneway void shutdown ();
+ };
+};
diff --git a/TAO/tests/Bug_3333_Regression/client.cpp b/TAO/tests/Bug_3333_Regression/client.cpp
new file mode 100644
index 00000000000..345c22a4075
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/client.cpp
@@ -0,0 +1,140 @@
+// $Id$
+
+#include "TestC.h"
+#include "ace/Get_Opt.h"
+#include "tao/Messaging/Messaging.h"
+
+ACE_RCSID(Hello, client, "$Id$")
+
+const ACE_TCHAR *ior = ACE_TEXT ("file://test.ior");
+const ACE_TCHAR *loop_forever_ior = ACE_TEXT ("file://forward_forever.ior");
+bool shutdown_only = false;
+
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:l:s"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'k':
+ ior = get_opts.opt_arg ();
+ break;
+ case 'l':
+ loop_forever_ior = get_opts.opt_arg ();
+ break;
+ case 's':
+ shutdown_only = true;
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-k <ior> "
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var tmp;
+ Test::Hello_var hello;
+
+ if (!shutdown_only)
+ {
+ tmp = orb->string_to_object (loop_forever_ior);
+
+ if (CORBA::is_nil (tmp.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "ERROR: Nil object from string_to_object of <%s>\n",
+ loop_forever_ior),
+ 1);
+ }
+
+ // Three second relative roundtrip timeout.
+ TimeBase::TimeT timeout_period = 30000000u;
+
+ CORBA::Any timeout_as_any;
+ timeout_as_any <<= timeout_period;
+
+ CORBA::PolicyList policy_list (1);
+ policy_list.length (1);
+ policy_list[0] =
+ orb->create_policy (Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
+ timeout_as_any);
+ tmp = tmp->_set_policy_overrides (policy_list,
+ CORBA::SET_OVERRIDE);
+
+ for (CORBA::ULong i = 0;
+ i < policy_list.length ();
+ ++i)
+ {
+ policy_list[i]->destroy ();
+ }
+
+ try
+ {
+ // This should LOCATION_FORWARD loop until the timeout
+ hello = Test::Hello::_narrow(tmp.in ());
+
+ if (CORBA::is_nil (hello.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "ERROR: Nil hello from <%s>\n",
+ loop_forever_ior),
+ 1);
+ }
+
+ CORBA::String_var the_string = hello->get_string ();
+
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "ERROR - We have managed to invoke a server method. \n"),
+ 1);
+ }
+ catch (const CORBA::TIMEOUT &)
+ {
+ // Hooray - all OK
+ ACE_DEBUG ((LM_DEBUG, "Test OK - RELATIVE_RT_TIMEOUT ends location forward loop.\n"));
+ }
+ }
+
+ tmp = orb->string_to_object (ior);
+
+ hello = Test::Hello::_narrow(tmp.in ());
+
+ if (CORBA::is_nil (hello.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "ERROR: Nil hello from <%s>\n",
+ ior),
+ 1);
+ }
+
+ hello->shutdown ();
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("ERROR: Exception caught:");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/TAO/tests/Bug_3333_Regression/run_test.pl b/TAO/tests/Bug_3333_Regression/run_test.pl
new file mode 100755
index 00000000000..a6f8de5ca49
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/run_test.pl
@@ -0,0 +1,65 @@
+eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}'
+ & eval 'exec perl -S $0 $argv:q'
+ if 0;
+
+# $Id$
+# -*- perl -*-
+
+use lib "$ENV{ACE_ROOT}/bin";
+use PerlACE::TestTarget;
+
+$status = 0;
+
+my $server = PerlACE::TestTarget::create_target (1) || die "Create target 1 failed\n";
+my $client = PerlACE::TestTarget::create_target (2) || die "Create target 2 failed\n";
+
+my $iorbase = "server.ior";
+my $forward_forever = "forward_forever.ior";
+my $server_iorfile = $server->LocalFile ($iorbase);
+my $client_iorfile = $client->LocalFile ($forward_forever);
+$server->DeleteFile($iorbase);
+$client->DeleteFile($forward_forever);
+
+$SV = $server->CreateProcess ("Bug3333_Server", "-o $server_iorfile -p $client_iorfile -ORBObjRefStyle URL -ORBCollocation NO");
+$CL = $client->CreateProcess ("Bug3333_Client", "-k file://$server_iorfile -l file://$client_iorfile");
+
+$server_status = $SV->Spawn ();
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ exit 1;
+}
+if ($server->WaitForFileTimed ($iorbase,
+ $server->ProcessStartWaitInterval()) == -1) {
+ print STDERR "ERROR: cannot find file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($server->GetFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot retrieve file <$server_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+if ($client->PutFile ($iorbase) == -1) {
+ print STDERR "ERROR: cannot set file <$client_iorfile>\n";
+ $SV->Kill (); $SV->TimedWait (1);
+ exit 1;
+}
+
+$client_status = $CL->SpawnWaitKill (30);
+if ($client_status != 0) {
+ print STDERR "ERROR: client returned $client_status\n";
+ $SHUTDOWN = $client->CreateProcess ("Bug3333_Client", " -k file://$server_iorfile -s");
+ $SHUTDOWN->SpawnWaitKill (30);
+ $status = 1;
+}
+
+$server_status = $SV->WaitKill ($server->ProcessStopWaitInterval());
+if ($server_status != 0) {
+ print STDERR "ERROR: server returned $server_status\n";
+ $status = 1;
+}
+
+$server->DeleteFile($iorbase);
+$client->DeleteFile($forward_forever);
+
+exit $status;
diff --git a/TAO/tests/Bug_3333_Regression/server.cpp b/TAO/tests/Bug_3333_Regression/server.cpp
new file mode 100644
index 00000000000..5f3243d16ff
--- /dev/null
+++ b/TAO/tests/Bug_3333_Regression/server.cpp
@@ -0,0 +1,142 @@
+// $Id$
+
+#include "Hello.h"
+#include "ace/Get_Opt.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/SString.h"
+#include "tao/IORTable/IORTable.h"
+
+ACE_RCSID (Hello,
+ server,
+ "$Id$")
+
+const ACE_TCHAR *ior_output_file = ACE_TEXT ("test.ior");
+const ACE_TCHAR *ior_output_file2 = ACE_TEXT ("forward_forever.ior");
+
+int
+parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:p:"));
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'o':
+ ior_output_file = get_opts.opt_arg ();
+ break;
+ case 'p':
+ ior_output_file2 = get_opts.opt_arg ();
+ break;
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage: %s "
+ "-o <iorfile>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+ACE_TMAIN(int argc, ACE_TCHAR *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv);
+
+ CORBA::Object_var poa_object =
+ orb->resolve_initial_references("RootPOA");
+
+ PortableServer::POA_var root_poa =
+ PortableServer::POA::_narrow (poa_object.in ());
+
+ if (CORBA::is_nil (root_poa.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Panic: nil RootPOA\n"),
+ 1);
+
+ PortableServer::POAManager_var poa_manager = root_poa->the_POAManager ();
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ Hello *hello_impl = 0;
+ ACE_NEW_RETURN (hello_impl,
+ Hello (orb.in ()),
+ 1);
+ PortableServer::ServantBase_var owner_transfer(hello_impl);
+
+ PortableServer::ObjectId_var id =
+ root_poa->activate_object (hello_impl);
+
+ CORBA::Object_var object = root_poa->id_to_reference (id.in ());
+
+ Test::Hello_var hello = Test::Hello::_narrow (object.in ());
+
+ CORBA::String_var ior = orb->object_to_string (hello.in ());
+
+ CORBA::Object_var iorTableObj =
+ orb->resolve_initial_references ("IORTable");
+
+ IORTable::Table_var iorTable
+ = IORTable::Table::_narrow (iorTableObj.in ());
+
+ // We are using this test with ObjRefStyle == URL ... or at
+ // least we better be. The IOR is therefore a corbaloc
+ ACE_CString full_corbaloc (ior.in (), 0, 1);
+
+ // Create a corbaloc for an IOR table binding that points to
+ // itself. Acessing this will make the server reply with LOCATION_FORWARD
+ // indefinitely.
+
+ // Get the endpoint info only...
+ CORBA::ULong first_slash = full_corbaloc.find ("/", 0);
+ ACE_CString forward_forever = full_corbaloc.substring (0,
+ first_slash);
+
+ // .. add the string we are going to bind against and then bind
+ forward_forever += "/hello";
+ iorTable->bind("hello", forward_forever.c_str ());
+
+ // Output the IORs
+ FILE *output_file= ACE_OS::fopen (ior_output_file, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s\n",
+ ior_output_file),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", ior.in ());
+ ACE_OS::fclose (output_file);
+
+ output_file = ACE_OS::fopen (ior_output_file2, "w");
+ if (output_file == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s\n",
+ ior_output_file2),
+ 1);
+ ACE_OS::fprintf (output_file, "%s", forward_forever.c_str ());
+ ACE_OS::fclose (output_file);
+
+ poa_manager->activate ();
+
+ orb->run ();
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n"));
+
+ root_poa->destroy (1, 1);
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Exception caught:");
+ return 1;
+ }
+
+ return 0;
+}