Hi Karel
Sorry but I have more details. We compile with stlport (version 5.1.5) (mico 2.3.12 with stlport 5.1.5 doesn't have this issue) The following causes nsd to crash on the fourth or fifth call to bind_new_context If I modify the following code to the example under demo/services/naming (batch file) set PATH=..\..\..\win32-bin;%PATH% set ADDR=win64-dev1 echo "starting Naming Service daemon ..." start ..\..\..\win32-bin\nsd -ORBNoResolve -ORBDebug All -ORBIIOPVersion 1.2 -ORBIIOPAddr inet:%ADDR%:12456 echo "starting Bank server ..." start .\server -ORBNoResolve -ORBGIOPVersion 1.2 -ORBIIOPVersion 1.2 -ORBNamingAddr corbaloc:iiop:[EMAIL PROTECTED]:12456/NameService pause echo "running client ..." .\client -ORBNoResolve -ORBGIOPVersion 1.2 -ORBIIOPVersion 1.2 -ORBNamingAddr corbaloc:iiop:[EMAIL PROTECTED]:12456/NameService (server.cc) #include <CORBA.h> #include <coss/CosNaming.h> #include "account.h" #include <sstream> using namespace std; /* * Implementation of the Account */ class Account_impl : virtual public POA_Account { public: Account_impl (); void deposit (CORBA::ULong); void withdraw (CORBA::ULong); CORBA::Long balance (); private: CORBA::Long bal; }; Account_impl::Account_impl () { bal = 0; } void Account_impl::deposit (CORBA::ULong amount) { bal += amount; } void Account_impl::withdraw (CORBA::ULong amount) { bal -= amount; } CORBA::Long Account_impl::balance () { return bal; } /* * Implementation of the Bank */ class Bank_impl : virtual public POA_Bank { public: Account_ptr create (); }; Account_ptr Bank_impl::create () { /* * Create a new account (which is never deleted) */ Account_impl * ai = new Account_impl; /* * Obtain a reference using _this. This implicitely activates the * account servant (the RootPOA, which is the object's _default_POA, * has the IMPLICIT_ACTIVATION policy) */ Account_ptr aref = ai->_this (); assert (!CORBA::is_nil (aref)); /* * Return the reference */ return aref; } /* * Main */ int main (int argc, char *argv[]) { /* * Initialize ORB, get the Root POA, and register Account object as usual */ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv,"mico-local-orb"); /* * Obtain a reference to the RootPOA and its Manager */ CORBA::Object_var poaobj = orb->resolve_initial_references ("RootPOA"); PortableServer::POA_var poa = PortableServer::POA::_narrow (poaobj); PortableServer::POAManager_var mgr = poa->the_POAManager(); /* * Create a Bank */ Bank_impl * micocash = new Bank_impl; /* * Activate the Bank */ PortableServer::ObjectId_var oid = poa->activate_object (micocash); CORBA::Object_var ref = poa->id_to_reference (oid.in()); /* * In demo/poa/account-1, this object reference (ref) is written to a * file. Here, we store the reference in the Naming Service */ /* * Acquire a reference to the Naming Service */ CORBA::Object_var nsobj = // orb->resolve_initial_references ("NameService"); orb->string_to_object("corbaloc:iiop:[EMAIL PROTECTED]:12456/NameService"); CosNaming::NamingContext_var nc = CosNaming::NamingContext::_narrow (nsobj); if (CORBA::is_nil (nc)) { cerr << "oops, I cannot access the Naming Service!" << endl; exit (1); } /* * Construct Naming Service name for our Bank */ const int MAX_NAMES = 10; CosNaming::Name name; for (int i = 0; i < MAX_NAMES ; i++) { name.length(i+1); stringstream str; str << "BankPath" << i + 1; name[i].id = CORBA::string_dup (str.str().c_str()); name[i].kind = CORBA::string_dup (""); if( i < MAX_NAMES -1) { try { nc->bind_new_context(name); } catch(CosNaming::NamingContext::AlreadyBound_catch &) { } } } cout << "Binding Bank in the Naming Service ... " << flush; nc->rebind (name, ref); cout << "done." << endl; /* * Activate the POA and start serving requests */ printf ("Running.\n"); mgr->activate (); orb->run(); /* * Shutdown (never reached) */ poa->destroy (TRUE, TRUE); delete micocash; return 0; } -----Original Message----- From: Malcolm Davey Sent: Thursday, 27 November 2008 10:51 AM To: 'Karel Gardas' Cc: 'mico-devel@mico.org' Subject: RE: [mico-devel] nsd registration failing for multiple registrations in 2.3.13 Hi Karel Thanks for your reply. As to why I am not using threading, the windows make files don't actual enable threading properly (they don't configure a header file to enable it). Also we haven't changed our code to make use of it. Compiler VS 2008 (VC 9) OS - Windows XP SP2 and 2003 64 bit I have one more detail on how to cause the problem. After getting the NamingConext (see the original code in first email) we register our own object under the name "MyPath/MySubPath/MyName" which we convert to CosName object. And register as following: NC->bind_new_context(CosName)// with CosName vector of "MyPath" NC->bind_new_context(CosName)// with CosName vector of "MyPath" and "MySubPath" NC->rebind(CosName, MyObj) )// with CosName vector of "MyPath","MySubPath" and" MyName" If I remove the "MySubPath" name, and hence not have a nested ( and only have one bind_new_context) then this removes the problems. If we don't remove it, subsequent clients connecting to nsd fail on the call to get the root NamingContext (in the original code mentioned below), or cause nsd to crash. I noticed in the demo under demo/services/naming-mt that bind_new_context is used but is used differently - once it is used, the new sub NamingContext is retrieved using NC->resolve(). The example is fairly involved and I haven't been able to get it working correctly on my machine yet (it doesn't come with windows makefile or script to run - I have got a make file for it but still not sure about the running). I have changed my code to use it, but this makes no difference - assuming I am implementing it correctly. Thanks Malcolm -----Original Message----- From: Karel Gardas [mailto:[EMAIL PROTECTED] Sent: Wednesday, 26 November 2008 7:49 PM To: Malcolm Davey Cc: mico-devel@mico.org Subject: Re: [mico-devel] nsd registration failing for multiple registrations in 2.3.13 Hi Malcolm, do you have a simple test case for this? I've tried with running several nsadmin against nsd but was not able to cause a crash. Also why have you disabled threading? Any particular reason for it? It would also be good if you tell us more about your platform (ie. OS version/compiler version, service packs/patches etc.) Cheers, Karel Malcolm Davey wrote: > Hi there > > > > The nsd have issues when we register with it. > > > > We have a windows compile of 2.3.13 with THREADS not defined or turned > off. > > > > Nsd command line is > > nsd -ORBIIOPAddr inet:%MACHINE%:%NAMINGSERVICEPORT% -ORBNoResolve > -ORBIIOPVersion 1.2 > > > > My applications use the following as the address: > corbaloc:iiop:[EMAIL PROTECTED]:%NAMINGSERVICEPORT%/NameService > > > > Where %MACHINE% is the machine name, %NAMINGSERVICEPORT% is the host > name > > > > Our code which calls does the registration is the following: > > > > Some initialization code is the following: > > > > m_orb = CORBA::ORB_init( CORBA_Argc, CORBA_Argv, > _TEXT("mico-local-orb")); > > CORBA::Object_var poaobj = m_orb->resolve_initial_references > ("RootPOA"); > > m_root_poa = PortableServer::POA::_narrow (poaobj); > > m_poa_mgr= m_root_poa->the_POAManager(); > > > > The code which has the problem is > > > > CosNaming::NamingContext_var NC; > > > > CORBA::ORB_var orb = CORBA::ORB_instance("mico-local-orb", false); > > if (CORBA::is_nil (orb)) > > return NC; > > > > CORBA::Object_var Obj; > > > > Obj = orb->string_to_object(Address.c_str()); > > > > NC = CosNaming::NamingContext::_narrow(Obj); > > return NC; > > > > The final narrow call fails, or causes nsd to crash. Nsd crashes in the > following code > > > > MICOPOA::POACurrent_impl::CurrentState::CurrentState > (PortableServer::POA_ptr _poa, POAObjectReference * _por, > PortableServer::Servant _serv) > > { > > poa = _poa; > > por = _por; > > serv = _serv; > > serv->_add_ref (); // crashs on this line - serv seems like it is > invalid > > } > > > > Call stack in release mode of crash with nsd.exe > > > >> mico2313.dll!MICOPOA::POACurrent_impl::set() Line 417 C++ > > mico2313.dll!MICOPOA::POA_impl::perform_invoke() Line 3996 C++ > > mico2313.dll!MICOPOA::POA_impl::local_invoke() Line 3565 C++ > > mico2313.dll!MICOPOA::POA_impl::invoke() Line 3421 C++ > > mico2313.dll!CORBA::ORB::invoke_async() Line 2581 C++ > > mico2313.dll!MICO::IIOPServer::exec_invoke_request() Line 5613 > C++ > > mico2313.dll!MICO::IIOPServer::handle_invoke_request() Line 5676 > C++ > > mico2313.dll!MICO::IIOPServer::handle_input() Line 5528 C++ > > mico2313.dll!MICO::IIOPServer::input_callback() Line 6154 C++ > > mico2313.dll!MICO::GIOPConn::do_read() Line 2769 C++ > > mico2313.dll!MICO::GIOPConn::callback() Line 2925 C++ > > mico2313.dll!MICO::SocketTransport::callback() Line 209 C++ > > mico2313.dll!MICO::SelectDispatcher::handle_fevents() Line 267 > C++ > > mico2313.dll!MICO::SelectDispatcher::run() Line 460 C++ > > mico2313.dll!CORBA::ORB::perform_work() Line 1751 C++ > > nsd.exe!main() Line 221 C++ > > nsd.exe!__tmainCRTStartup() Line 586 C > > > > We have two apps, which register with the name service. When the second > one registers nsd crashes. If the second one registers first then this > work, but then when the first apps registeration fails. Nds.exe only > seems to work for the first registration - when we substitute the 2.3.12 > or 2.3.8 versions they nsd.exe in they work all the time. > > > > We also built some of the tests which come with the source. > > When running any of the messaging tests we get the errror message > "ERROR: exception not thrown" - don't know if this is the same problem > or different. > > > > > > Malcolm > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Mico-devel mailing list > Mico-devel@mico.org > http://www.mico.org/mailman/listinfo/mico-devel -- Karel Gardas [EMAIL PROTECTED] ObjectSecurity Ltd. http://www.objectsecurity.com _______________________________________________ Mico-devel mailing list Mico-devel@mico.org http://www.mico.org/mailman/listinfo/mico-devel