summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-03-27 19:05:41 +0000
committerzhangw <zhangw@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2006-03-27 19:05:41 +0000
commitdd6ceabce662f45f89ac42551ce34fe8c399d5e6 (patch)
tree7a6e4f750ec91d42e0bd6352c054326c18232930
parent42d660c436446ca7bb0de639b6abaae3cf22fa77 (diff)
downloadATCD-dd6ceabce662f45f89ac42551ce34fe8c399d5e6.tar.gz
Mon Mar 27 18:55:51 UTC 2006 Wallace Zhang <zhangw@ociweb.com>
-rw-r--r--TAO/ChangeLog35
-rwxr-xr-xTAO/orbsvcs/tests/Security/MT_SSLIOP/run_test_harsh.pl65
-rw-r--r--TAO/tao/Connection_Handler.cpp5
-rw-r--r--TAO/tao/Resume_Handle.cpp51
-rw-r--r--TAO/tao/Resume_Handle.h6
5 files changed, 160 insertions, 2 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index ceac6f4e066..0c091c3feed 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,38 @@
+Mon Mar 27 18:55:51 UTC 2006 Wallace Zhang <zhangw@ociweb.com>
+
+ * orbsvcs/tests/Security/MT_SSLIOP/run_test_harsh.pl:
+ * tao/Connection_Handler.cpp:
+ * tao/Resume_Handle.h:
+ * tao/Resume_Handle.cpp:
+
+ Merged in fixes from OCI 1.4a.
+ Tue Feb 21 16:29:32 UTC 2006 Don Busch <busch_d@ociweb.com>
+
+ * tao/Connection_Handler.cpp
+ * tao/Resume_Handle.h
+ * tao/Resume_Handle.cpp
+ * orbsvcs/tests/Security/MT_SSLIOP/run_test_harsh.pl
+
+ RT8248 is a race condition involving two threads active in the
+ same connection handler at the same time. The race is fixed by
+ ensuring that a connection handler that has allowed its handle
+ to be resumed in the Reactor does not return "1" from
+ handle_input. "1" is the Reactor's "call me back immediately"
+ value. Essentially, you can't give up ownership of yourself twice
+ -- you give up owner-
+ ship when you resume the handle, so you can't ask to be called
+ back immediately. (The SSLIOP handler is the only one that ever
+ returns 1, so that's the only handler in which this
+ manifests itself)
+
+ The additional test (run_test_harsh.pl) is a longer (~5 minute)
+ version of the MT_SSLIOP test that fails without this change,
+ but succeeds with it.
+
+ Also moved the code for Ciju's "connection close" fix of
+ "Fri Dec 16 14:40:54 2005" from the Connection_Handler.cpp
+ to the Resume_Handle.cpp.
+
Mon Mar 27 10:29:08 UTC 2006 Ossama Othman <ossama_othman at symantec dot com>
* tao/ORB_Core.cpp (destroy_interceptors):
diff --git a/TAO/orbsvcs/tests/Security/MT_SSLIOP/run_test_harsh.pl b/TAO/orbsvcs/tests/Security/MT_SSLIOP/run_test_harsh.pl
new file mode 100755
index 00000000000..d1480fd47d1
--- /dev/null
+++ b/TAO/orbsvcs/tests/Security/MT_SSLIOP/run_test_harsh.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 '../../../../../bin';
+use PerlACE::Run_Test;
+
+$status = 0;
+$threads = '4';
+$iorfile = PerlACE::LocalFile ("test.ior");
+$sv_conf = PerlACE::LocalFile ("server$PerlACE::svcconf_ext");
+$cl_conf = PerlACE::LocalFile ("client$PerlACE::svcconf_ext");
+
+unlink $iorfile;
+
+$SV = new PerlACE::Process ("server", "-ORBsvcconf $sv_conf -o $iorfile -n $threads");
+
+$CL1 = new PerlACE::Process
+ ("client", "-k file://$iorfile -n 10 -i 1000 -ORBSvcConf $cl_conf");
+
+$CLS = new PerlACE::Process
+ ("client", "-k file://$iorfile -n 10 -i 1000 -ORBSvcConf $cl_conf -x");
+
+$SV->Spawn ();
+
+if (PerlACE::waitforfile_timed ($iorfile, 5) == -1) {
+ print STDERR "ERROR: cannot find file <$iorfile>\n";
+ $SV->Kill ();
+ exit 1;
+}
+
+$CL1->Spawn ();
+$client = $CL1->WaitKill (480);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1;
+}
+
+$client = $CLS->SpawnWaitKill (480);
+
+if ($client != 0) {
+ print STDERR "ERROR: client returned $client\n";
+ $status = 1
+}
+
+$server = $SV->WaitKill (5);
+
+if ($server != 0) {
+ print STDERR "ERROR: server returned $server\n";
+ $status = 1
+}
+
+unlink $iorfile;
+
+exit $status
+
+
+
+
+
diff --git a/TAO/tao/Connection_Handler.cpp b/TAO/tao/Connection_Handler.cpp
index 82452d015f5..01d381e023a 100644
--- a/TAO/tao/Connection_Handler.cpp
+++ b/TAO/tao/Connection_Handler.cpp
@@ -203,6 +203,11 @@ TAO_Connection_Handler::handle_output_eh (
return_value = this->transport ()->handle_output ();
this->pos_io_hook (return_value);
+
+ // Bug 1647; might need to change resume_handle's flag or
+ // change handle_input return value.
+ resume_handle.handle_input_return_value_hook(return_value);
+
if (return_value != 0)
{
resume_handle.set_flag (TAO_Resume_Handle::TAO_HANDLE_LEAVE_SUSPENDED);
diff --git a/TAO/tao/Resume_Handle.cpp b/TAO/tao/Resume_Handle.cpp
index 3cb6d7199ec..6ce7297a70f 100644
--- a/TAO/tao/Resume_Handle.cpp
+++ b/TAO/tao/Resume_Handle.cpp
@@ -1,5 +1,6 @@
#include "tao/Resume_Handle.h"
#include "tao/ORB_Core.h"
+#include "debug.h"
#include "ace/Reactor.h"
@@ -7,8 +8,8 @@
# include "tao/Resume_Handle.inl"
#endif /* __ACE_INLINE__ */
-ACE_RCSID (tao,
- Resume_Handle,
+ACE_RCSID (tao,
+ Resume_Handle,
"$Id$")
@@ -31,4 +32,50 @@ TAO_Resume_Handle::resume_handle (void)
this->flag_ = TAO_HANDLE_ALREADY_RESUMED;
}
+void
+TAO_Resume_Handle::handle_input_return_value_hook (int& return_value)
+{
+ // RT8248: The return value is only changed from 1 to 0 if:
+ // 1) the handle_input return value wants an immediate callback
+ // on the handle (i.e. will return "1")
+ // 2) this->resume_handle was already called
+ // 3) reactor->resume_handler was called by this->resume_handle
+ // The value is changed because you can't ask for an immediate callback
+ // on a handle that you have already given up ownership of. (RT8248)
+ if ( return_value == 1 &&
+ this->flag_ == TAO_HANDLE_ALREADY_RESUMED &&
+ this->orb_core_ &&
+ this->orb_core_->reactor ()->resumable_handler () &&
+ this->handle_ != ACE_INVALID_HANDLE)
+ {
+ // a return value of "1" means "call me back immediately;
+ // but we can't "call me back immediately" on an
+ // already-resumed handle
+ return_value = 0;
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
+ "overriding return value of 1 with retval = %d\n",
+ return_value));
+ }
+ }
+ else if ( return_value == -1 )
+ {
+ // this covers the "connection close" case, where you want
+ // to leave the handle suspended if you're return -1 to
+ // remove the handle from the Reactor. (See ChangeLog entry
+ // Fri Dec 16 14:40:54 2005)
+ this->flag_ = TAO_HANDLE_LEAVE_SUSPENDED;
+
+ if (TAO_debug_level > 6)
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) - Resume_Handle::handle_input_return_value_hook, "
+ "handle_input returning -1, so handle is not resumed.\n"));
+ }
+ }
+}
+
TAO_END_VERSIONED_NAMESPACE_DECL
diff --git a/TAO/tao/Resume_Handle.h b/TAO/tao/Resume_Handle.h
index d028c4108f0..9fd1f4949e9 100644
--- a/TAO/tao/Resume_Handle.h
+++ b/TAO/tao/Resume_Handle.h
@@ -73,6 +73,12 @@ public:
/// reactor. Else we don't resume the handle.
void resume_handle (void);
+ // Hook method called at the end of a connection handler's
+ // handle_input function. Might override the handle_input
+ // return value or change the resume_handler's flag_ value.
+ void handle_input_return_value_hook (int& return_value);
+
+
private:
/// Our ORB Core.