diff options
author | Adam Mitz <mitza-oci@users.noreply.github.com> | 2006-08-02 20:18:42 +0000 |
---|---|---|
committer | Adam Mitz <mitza-oci@users.noreply.github.com> | 2006-08-02 20:18:42 +0000 |
commit | 2c2cec82a6f472d67960a0a1558ced6169441e76 (patch) | |
tree | 65a18f5451a11e3fdf9df1ab0fdf0461c063c858 | |
parent | 97daf39bc6c9d136615da301e13a198018c886a9 (diff) | |
download | ATCD-2c2cec82a6f472d67960a0a1558ced6169441e76.tar.gz |
Wed Aug 2 20:15:37 UTC 2006 Adam Mitz <mitza@ociweb.com>
12 files changed, 521 insertions, 14 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 636ba3deed5..5f71b22a8d7 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,41 @@ +Wed Aug 2 20:15:37 UTC 2006 Adam Mitz <mitza@ociweb.com> + + * orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp: + Updated comment to reflect what's actually in the code. + + * orbsvcs/ImplRepo_Service/ImR_Locator_i.h: + * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp: + + This is a fix for bugzilla bug #2604. This only applies to + per_client activation mode. The ImR may receive + "server_is_running()" invocations from servers that it did + not launch (they may have been launched by a prior instance + of the ImR or manually). When this happens the ImR records + the info about the running server and places it on a queue. + Later, when a client request comes in a new server is + launched (as it should be), but the old queued server info is + used to ping it. This can fail with various exceptions + depending on if the old process is still alive or if some + other process is now running on its port. If it fails enough + times (greater than the retry count) the client invocation + will fail. The fix is simply to keep track of whether or not + the ImR expects a new server (that it launched) to be coming + online. If not, it can ignore the server_is_running(). This + mechanism is already in place for normal activation, but due + to differences in per_client it doesn't work there. + + * orbsvcs/tests/ImplRepo/Bug_2604_Regression: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/Bug_2604.mpc: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger.idl: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerClient.cpp: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerServer.cpp: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.h: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/README: + * orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl: + + New regeression test for the bugfix described above. + Wed Aug 2 15:11:08 UTC 2006 Simon McQueen <sm@prismtech.com> * orbsvcs/orbsvcs/FaultTolerance/FT_ClientRequest_Interceptor.h: diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp index 7017ec1827d..10054ccacff 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Activator_i.cpp @@ -58,7 +58,8 @@ createPersistentPOA (PortableServer::POA_ptr root_poa, const char* poa_name ACE_ // It's ok if we can't register with the ImR. It just // means we won't be able to notify it of any events -// (Currently, just that we're shutting down.) +// (Currently, just that we're shutting down and to +// notify of the ImR when a child process exits.) void ImR_Activator_i::register_with_imr (ImplementationRepository::Activator_ptr activator) { diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp index 95684378c77..25a079255e9 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp @@ -582,9 +582,10 @@ ACE_THROW_SPEC ((CORBA::SystemException, (CORBA::string_dup ("Cannot start server.")), 0); } - // Note : We already updated info with StartupInfo in server_is_running () + // Note: We already updated info with StartupInfo in server_is_running () ImplementationRepository::StartupInfo_var si = - start_server (info, manual_start ACE_ENV_ARG_PARAMETER); + start_server (info, manual_start, info.waiting_clients + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); } } @@ -595,10 +596,12 @@ ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound, ImplementationRepository::CannotActivate)) { + Server_Info_Ptr shared_info = this->repository_.get_server (info.name); do { ImplementationRepository::StartupInfo* psi = - start_server (info, manual_start ACE_ENV_ARG_PARAMETER); + start_server (info, manual_start, shared_info->waiting_clients + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); if (psi != 0) @@ -631,7 +634,8 @@ ACE_THROW_SPEC ((CORBA::SystemException, } ImplementationRepository::StartupInfo* -ImR_Locator_i::start_server (Server_Info& info, bool manual_start ACE_ENV_ARG_DECL) +ImR_Locator_i::start_server (Server_Info& info, bool manual_start, + int& waiting_clients ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound, ImplementationRepository::CannotActivate)) @@ -665,9 +669,10 @@ ACE_THROW_SPEC ((CORBA::SystemException, ACE_TRY { - ++ info.waiting_clients; + ++waiting_clients; - if (info.waiting_clients <= 1 || info.activation_mode == ImplementationRepository::PER_CLIENT) + if (waiting_clients <= 1 || + info.activation_mode == ImplementationRepository::PER_CLIENT) { info.starting = true; ++info.start_count; @@ -697,7 +702,7 @@ ACE_THROW_SPEC ((CORBA::SystemException, waiter_->wait_for_startup (info.name.c_str () ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - -- info.waiting_clients; + --waiting_clients; info.starting = false; return si._retn (); @@ -708,13 +713,13 @@ ACE_THROW_SPEC ((CORBA::SystemException, { ACE_DEBUG ((LM_DEBUG, "ImR: <%s> Skipping wait. Already started.\n", info.name.c_str ())); } - -- info.waiting_clients; + --waiting_clients; info.starting = false; } } ACE_CATCH (CORBA::TIMEOUT, ex) { - -- info.waiting_clients; + --waiting_clients; info.starting = false; // We may have connected successfully, because the timeout could occur before // the AsyncStartupWaiter manages to return. In fact, when the ImR is very busy @@ -728,7 +733,7 @@ ACE_THROW_SPEC ((CORBA::SystemException, } ACE_CATCH (ImplementationRepository::CannotActivate, ex) { - -- info.waiting_clients; + --waiting_clients; info.starting = false; info.reset (); if (debug_ > 0) @@ -736,7 +741,7 @@ ACE_THROW_SPEC ((CORBA::SystemException, } ACE_CATCHANY { - -- info.waiting_clients; + --waiting_clients; info.starting = false; if (debug_ > 0) ACE_DEBUG ((LM_DEBUG, "ImR: Unexpected exception while starting <%s>.\n", info.name.c_str ())); @@ -1061,7 +1066,16 @@ ImR_Locator_i::server_is_running (const char* name, } else { // Note : There's no need to unblock all the waiting request until // we know the final status of the server. - waiter_svt_.unblock_one (name, partial_ior, ior.in (), true); + if (info->waiting_clients > 0) + { + waiter_svt_.unblock_one (name, partial_ior, ior.in (), true); + } + else if (this->debug_ > 1) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("ImR - Ignoring server_is_running due to no ") + ACE_TEXT ("waiting PER_CLIENT clients.\n"))); + } } } } diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h index 7dd3033bcbc..895105f29f8 100644 --- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h +++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.h @@ -1,3 +1,4 @@ +// -*- C++ -*- // $Id$ #ifndef IMR_LOCATOR_I_H @@ -129,7 +130,8 @@ private: ImplementationRepository::CannotActivate)); ImplementationRepository::StartupInfo* - start_server(Server_Info& info, bool manual_start ACE_ENV_ARG_DECL) + start_server(Server_Info& info, bool manual_start, int& waiting_clients + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, ImplementationRepository::NotFound, ImplementationRepository::CannotActivate)); diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Bug_2604.mpc b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Bug_2604.mpc new file mode 100644 index 00000000000..57d342ca851 --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Bug_2604.mpc @@ -0,0 +1,17 @@ +// $Id$ + +project(*Server): taoexe, portableserver, minimum_corba { + idlflags += -Sc -Sa -St + Source_Files { + Messenger_i.cpp + MessengerServer.cpp + } +} + +project(*Client): taoexe, minimum_corba { + idlflags += -Sc -Sa -St + Source_Files { + MessengerC.cpp + MessengerClient.cpp + } +} diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger.idl b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger.idl new file mode 100644 index 00000000000..2bc3637b34a --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger.idl @@ -0,0 +1,5 @@ +// $Id$ +interface Messenger { + boolean send_message (in string user_name, in string subject, + inout string message); +}; diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerClient.cpp b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerClient.cpp new file mode 100644 index 00000000000..c4ac2fc38be --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerClient.cpp @@ -0,0 +1,49 @@ +// $Id$ + +#include "MessengerC.h" + +#include "ace/Log_Msg.h" +#include "ace/SString.h" + +int main (int argc, char *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + CORBA::Object_var obj = orb->string_to_object ("file://messenger.ior"); + Messenger_var messenger = Messenger::_narrow (obj.in ()); + if (CORBA::is_nil (messenger.in ())) + { + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Unable to get a Messenger " + "reference.\n")), -1); + } + + CORBA::String_var message = CORBA::string_dup("Hello!"); + for (int i(0); i < 6; ++i) + { + try + { + messenger->send_message("TAO User", "TAO Test", + message.inout ()); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Message was sent\n" + "Client got reply: %s\n"), + message.in())); + } + catch (CORBA::Exception &ex) + { + ACE_CString str = ex._info (); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Client send_message () " + "caught: %s\n"), + ACE_TEXT_CHAR_TO_TCHAR (str.c_str ())), -1); + } + } + return 0; + } + catch (CORBA::Exception &ex) + { + ACE_CString str = ex._info (); + ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("Client main() caught: %s\n"), + ACE_TEXT_CHAR_TO_TCHAR (str.c_str ())), -1); + } + return -1; +} diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerServer.cpp b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerServer.cpp new file mode 100644 index 00000000000..0eac2f5e123 --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/MessengerServer.cpp @@ -0,0 +1,87 @@ +// $Id$ +#include "Messenger_i.h" + +#include "ace/SString.h" +#include "ace/OS_NS_unistd.h" +#include "ace/OS_NS_string.h" +#include "ace/OS_NS_stdio.h" + +PortableServer::POA_ptr +createPersistentPOA (PortableServer::POA_ptr root_poa, const char *poa_name) +{ + CORBA::PolicyList policies; + policies.length (2); + + policies[0] = root_poa->create_lifespan_policy (PortableServer::PERSISTENT); + policies[1] = + root_poa->create_id_assignment_policy (PortableServer::USER_ID); + + PortableServer::POAManager_var mgr = root_poa->the_POAManager (); + + PortableServer::POA_var poa = root_poa->create_POA (poa_name, mgr.in (), + policies); + policies[0]->destroy (); + policies[1]->destroy (); + + return poa._retn (); +} + +void +writeIORFile (const char* ior) +{ + FILE *out = ACE_OS::fopen ("messenger.ior", "w"); + if (out) + { + ACE_OS::fprintf (out, "%s", ior); + ACE_OS::fclose (out); + } +} + +int +main (int argc, char *argv[]) +{ + try + { + CORBA::ORB_var orb = CORBA::ORB_init (argc, argv); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Server Process started\n"))); + + CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA"); + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (obj.in ()); + + PortableServer::POAManager_var mgr = root_poa->the_POAManager (); + + const char* poa_name = "MessengerService"; + + PortableServer::POA_var poa = createPersistentPOA (root_poa.in (), + poa_name); + Messenger_i servant (orb.in ()); + + PortableServer::ObjectId_var object_id = + PortableServer::string_to_ObjectId ("object"); + + poa->activate_object_with_id (object_id.in (), &servant); + obj = poa->id_to_reference (object_id.in ()); + CORBA::String_var ior = orb->object_to_string (obj.in ()); + + writeIORFile (ior.in ()); + + mgr->activate (); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Messenger server ready.\n"))); + + orb->run (); + + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) Messenger server shutting " + "down.\n"))); + root_poa->destroy (1, 1); + orb->destroy (); + return 0; + } + catch (CORBA::Exception &ex) + { + ACE_CString str = ex._info (); + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Server main() caught: %s\n"), + ACE_TEXT_CHAR_TO_TCHAR (str.c_str ()))); + } + return -1; +} diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp new file mode 100644 index 00000000000..c54fdfffb31 --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.cpp @@ -0,0 +1,18 @@ +// $Id$ +#include "Messenger_i.h" + +CORBA::Boolean +Messenger_i::send_message (const char *user_name, const char *subject, + char *& message) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Message from: %s\nSubject: %s\nMessage: %s" + "\n"), user_name, subject, message)); + const char *reply = "A reply from the server."; + message = CORBA::string_dup (reply); + if (++this->count_ == 6) + { + this->orb_->shutdown (0); + } + return true; +} diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.h b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.h new file mode 100644 index 00000000000..2c5a471b433 --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/Messenger_i.h @@ -0,0 +1,25 @@ +// -*- C++ -*- +// $Id$ +#ifndef MESSENGERI_H_ +#define MESSENGERI_H_ + +#include "MessengerS.h" + +class Messenger_i : public virtual POA_Messenger +{ +public: + Messenger_i (CORBA::ORB_ptr orb) + : count_ (0), + orb_ (CORBA::ORB::_duplicate (orb)) + {} + + virtual CORBA::Boolean + send_message (const char *user_name, const char *subject, char *&message) + ACE_THROW_SPEC((CORBA::SystemException)); + +private: + int count_; + CORBA::ORB_var orb_; +}; + +#endif diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/README b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/README new file mode 100644 index 00000000000..1d7e4626ed6 --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/README @@ -0,0 +1,125 @@ +Purpose: + This test demonstrates bug 2604 (see Bugzilla for details), which + involves per_client activation failures with the ImR. + +Strategy: + The test simulates normal client/ImR/server interactions in the + per_client activation mode. The only difference is that the server is + started 'manually' (by the shell, not the ImR Activator) twice before + the client starts. Once the client starts up, if the ImR gets confused + and tries to ping one of the old servers, the test will fail. If the + ImR correctly launches a new server and pings it, the test passes. + +To run: + ./run_test.pl + +Analysis of result: + Perl script will always return zero on success, non-zero on failure. + +Example output from a passing test: + +>>> /tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/ImplRepo_Service/./ImplRepo_Service -d 2 -ORBObjRefStyle url -t 30 -v 1000 -o /tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/imr.ior + timeout = 5 +Implementation Repository: Running + Ping Interval : 1000ms + Startup Timeout : 30s + Persistence : Disabled + Multicast : Disabled + Debug : 2 + Locked : False + +>>> /tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/ImplRepo_Service/./ImR_Activator -l -d 2 -ORBObjRefStyle url -o /tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/activator.ior -ORBInitRef ImplRepoService=file:///tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/imr.ior + timeout = 5 +ImR Activator: Starting oci1329 +ImR Activator: Contacting ImplRepoService... +ImR: Activator registered for oci1329. +ImR Activator: Registered with ImR. +ImR Activator: The Activator IOR is: <IOR:012a2a2a2b00000049444c3a496d706c656d656e746174696f6e5265706f7369746f72792f416374697661746f723a312e30002a0100000000000000980000000101022a130000006f6369313332392e6f63697765622e636f6d002aa3a92a2a3e00000014010f004e55500000001e0000000001000000526f6f74504f4100496d525f416374697661746f72000000000001000000496d525f416374697661746f722a2a020000000000000008000000012a2a2a004f41540100000018000000012a2a2a0100010001000000010001050901010000000000> +>>> /tao_builds/mitza/1.4a/ACE_wrappers/bin/tao_imr +ImR: Cannot find server <MessengerService> +ImR: Add/Update server <MessengerService>. +ImR: Adding server <MessengerService>. +ImR: Server: MessengerService + Activator: oci1329 + Command Line: ././MessengerServer -ORBObjRefStyle url -ORBEndpoint iiop://:8923/portspan=3 + Working Directory: + Activation: PER_CLIENT + Start Limit: 2 + +Successfully registered <MessengerService>. +>>> /tao_builds/mitza/1.4a/ACE_wrappers/bin/tao_imr -ORBInitRef ImplRepoService=file:///tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/imr.ior add MessengerService -a per_client -r 1 -l oci1329 -c "././MessengerServer -ORBObjRefStyle url -ORBEndpoint iiop://:8923/portspan=3" +ImR: List servers. +ImR_Locator_i::list: Filling ServerList with 1 servers +Server <MessengerService> + Activator: oci1329 + Command Line: ././MessengerServer -ORBObjRefStyle url -ORBEndpoint iiop://:8923/portspan=3 + Working Directory: + Activation Mode: PER_CLIENT + Number of retries: 1 + No running info available for PER_CLIENT mode + +>>> ././MessengerServer -orbuseimr 1 -ORBObjRefStyle url -ORBInitRef ImplRepoService=file:///tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/imr.ior + timeout = 30 +(20213|2808477376) Server Process started +ImR: Server MessengerService is running at corbaloc:iiop:1.2@oci1329.ociweb.com:58317/. +ImR: Server MessengerService callback at corbaloc:iiop:1.2@oci1329.ociweb.com:58317/%14%01%0f%00RST%9d%db%c0D%86L%0d%00%00%00%00%00%01%00%00%00%01%00%00%00. +ImR - Ignoring server_is_running due to no waiting PER_CLIENT clients. +(20213|2808477376) Messenger server ready. +>>> ././MessengerServer -orbuseimr 1 -ORBObjRefStyle url -ORBInitRef ImplRepoService=file:///tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/imr.ior + timeout = 30 +(20214|2808850112) Server Process started +ImR: Server MessengerService is running at corbaloc:iiop:1.2@oci1329.ociweb.com:43532/. +ImR: Server MessengerService callback at corbaloc:iiop:1.2@oci1329.ociweb.com:43532/%14%01%0f%00RST%9d%db%c0D%98h%0e%00%00%00%00%00%01%00%00%00%01%00%00%00. +ImR - Ignoring server_is_running due to no waiting PER_CLIENT clients. +(20214|2808850112) Messenger server ready. +ImR: Activating server <MessengerService>. +ImR: Starting server <MessengerService>. Attempt 1/2. +ImR Activator: Starting server <MessengerService>... + command line : <././MessengerServer -ORBObjRefStyle url -ORBEndpoint iiop://:8923/portspan=3> + directory : <> +ImR Activator: Register death handler for process 20216. +ImR Activator: Successfully started <MessengerService>. +ImR: Waiting for <MessengerService> to start... +(20216|2809108160) Server Process started +ImR: Server MessengerService is running at corbaloc:iiop:1.2@oci1329.ociweb.com:8923/. +ImR: Server MessengerService callback at corbaloc:iiop:1.2@oci1329.ociweb.com:8923/%14%01%0f%00RST%9e%db%c0D%deh%03%00%00%00%00%00%01%00%00%00%01%00%00%00. +ImR: Connected to server <MessengerService> +(20216|2809108160) Messenger server ready. +ImR: <MessengerService> Ping successful. alive=true +ImR: Successfully activated <MessengerService> at + corbaloc:iiop:1.2@oci1329.ociweb.com:8923/ +ImR: Forwarding invocation on <MessengerService> to <corbaloc:iiop:1.2@oci1329.ociweb.com:8923/%14%01%0f%00NUP%00%00%00!%00%00%00%00%01%00%00%00RootPOA%00MessengerService%00%00%00%00%00%01%00%00%00object> +Message from: TAO User +Subject: TAO Test +Message: Hello! +Message was sent +Client got reply: A reply from the server. +Message from: TAO User +Subject: TAO Test +Message: A reply from the server. +Message was sent +Client got reply: A reply from the server. +Message from: TAO User +Subject: TAO Test +Message: A reply from the server. +Message was sent +Client got reply: A reply from the server. +Message from: TAO User +Subject: TAO Test +Message: A reply from the server. +Message was sent +Client got reply: A reply from the server. +Message from: TAO User +Subject: TAO Test +Message: A reply from the server. +Message was sent +Client got reply: A reply from the server. +Message from: TAO User +Subject: TAO Test +Message: A reply from the server. +ImR: Server <MessengerService> is shutting down. +Message was sent +Client got reply: A reply from the server. +mitza@oci1329:/tao_builds/mitza/1.4a/ACE_wrappers/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression$ (20216|2809108160) Messenger server shutting down. + +(Note that the end of the output overlaps the shell printing the next prompt.) diff --git a/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl new file mode 100755 index 00000000000..17d3baacc3e --- /dev/null +++ b/TAO/orbsvcs/tests/ImplRepo/Bug_2604_Regression/run_test.pl @@ -0,0 +1,126 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ + +use Env (ACE_ROOT); +use lib "$ACE_ROOT/bin"; +use PerlACE::Run_Test; +use Sys::Hostname; + +my $WAIT_TIMEOUT = $PerlACE::wait_interval_for_process_creation; +my $DEBUG_LEVEL = 2; +my $OBJ_REF_STYLE = "-ORBObjRefStyle url"; + +my $implrepo_server = + "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImplRepo_Service"; +my $imr_activator = "$ENV{TAO_ROOT}/orbsvcs/ImplRepo_Service/ImR_Activator"; +my $tao_imr = "$ENV{ACE_ROOT}/bin/tao_imr"; + +my $implrepo_ior = PerlACE::LocalFile("imr.ior"); +my $activator_ior = PerlACE::LocalFile("activator.ior"); +my $messenger_ior = PerlACE::LocalFile("messenger.ior"); +my $messenger_bak = PerlACE::LocalFile("messenger.bak"); + +my $imr_init_ref = "-ORBInitRef ImplRepoService=file://$implrepo_ior"; + +my $Svr = new PerlACE::Process("MessengerServer", + "-orbuseimr 1 $OBJ_REF_STYLE $imr_init_ref"); +my $Cli = new PerlACE::Process("MessengerClient"); + +my $server_cmd = $Svr->Executable(); + +sub CleanupOutput { + unlink $messenger_ior; + unlink $implrepo_ior; + unlink $activator_ior; + unlink $messenger_bak; +} + +sub SpawnWait { + my $process = shift; + my $file = shift; + my $timeout = shift; + if (!defined $timeout) { + $timeout = $WAIT_TIMEOUT; + } + + print ">>> " . $process->CommandLine() . "\n\ttimeout = $timeout\n"; + $process->Spawn(); + my $ret = PerlACE::waitforfile_timed($file, $timeout); + if ($ret == -1) { + print STDERR "ERROR: Cannot find file <$file>\n"; + } + return $ret; +} + +my $ImR = new PerlACE::Process ($implrepo_server, "-d $DEBUG_LEVEL " + ."$OBJ_REF_STYLE -t 30 -v 1000 " + ."-o $implrepo_ior "); +my $Act = new PerlACE::Process ($imr_activator, "-l -d $DEBUG_LEVEL " + ."$OBJ_REF_STYLE -o $activator_ior " + ."$imr_init_ref"); + +my $imr_util = new PerlACE::Process ("$tao_imr"); +# We want the tao_imr executable to be found exactly in the path +# given, without being modified by the value of -ExeSubDir. +# So, we tell its Process object to ignore the setting of -ExeSubDir. +$imr_util->IgnoreExeSubDir(1); + +sub RunImRUtil { + my $cmd = shift; + print ">>> " . $imr_util->CommandLine() . "\n"; + $imr_util->Arguments("$imr_init_ref $cmd"); + return $imr_util->SpawnWaitKill(5); +} + +CleanupOutput(); + +if (SpawnWait($ImR, $implrepo_ior) != 0) { + $ImR->Kill(); + exit 1; +} + +if (SpawnWait($Act, $activator_ior) != 0) { + $ImR->Kill(); + exit 1; +} + +my $actname = hostname; +RunImRUtil("add MessengerService -a per_client -r 1 -l $actname -c \"" + . "$server_cmd $OBJ_REF_STYLE " + . "-ORBEndpoint iiop://:8923/portspan=3\""); +RunImRUtil("list -v"); + +#start the server manually twice + +if (SpawnWait($Svr, $messenger_ior, 30) != 0) { + $Act->Kill(); + $ImR->Kill(); + exit 1; +} +$Svr->Kill(); +unlink $messenger_ior; + +if (SpawnWait($Svr, $messenger_ior, 30) != 0) { + $Act->Kill(); + $ImR->Kill(); + exit 1; +} +$Svr->Kill(); + +if ($Cli->SpawnWaitKill(1000) != 0) { + print STDERR "Error : Client failed to run correctly."; + $Act->Kill(); + $ImR->Kill(); + CleanupOutput(); + exit 1; +} + +$Act->Kill(); +$ImR->Kill(); + +CleanupOutput(); + +exit 0; |