diff options
-rw-r--r-- | CHANGELOG-3.7.md | 5 | ||||
-rw-r--r-- | config/PropertyNames.xml | 2 | ||||
-rwxr-xr-x | config/makeprops.py | 12 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/PropertyNames.h | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/RegistryI.cpp | 19 | ||||
-rw-r--r-- | cpp/src/IceGrid/TraceLevels.cpp | 3 | ||||
-rw-r--r-- | cpp/src/IceGrid/TraceLevels.h | 3 | ||||
-rw-r--r-- | cpp/src/IceLocatorDiscovery/PluginI.cpp | 71 | ||||
-rw-r--r-- | csharp/src/Ice/PropertyNames.cs | 4 | ||||
-rw-r--r-- | csharp/src/IceLocatorDiscovery/PluginI.cs | 93 | ||||
-rw-r--r-- | java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java | 4 | ||||
-rw-r--r-- | java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java | 77 | ||||
-rw-r--r-- | java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java | 4 | ||||
-rw-r--r-- | java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java | 77 | ||||
-rw-r--r-- | js/src/Ice/PropertyNames.js | 2 | ||||
-rw-r--r-- | scripts/IceGridUtil.py | 2 | ||||
-rw-r--r-- | scripts/Util.py | 10 | ||||
-rw-r--r-- | scripts/tests/IceGrid/simple.py | 14 |
19 files changed, 381 insertions, 27 deletions
diff --git a/CHANGELOG-3.7.md b/CHANGELOG-3.7.md index a3e479524d6..a848884a31e 100644 --- a/CHANGELOG-3.7.md +++ b/CHANGELOG-3.7.md @@ -27,6 +27,11 @@ These are the changes since Ice 3.7.0 included in this pre-release. ## General Changes +- Added tracing support for IceGrid and locator discovery. The IceGrid registry + supports the `IceGrid.Registry.Trace.Discovery` property and the + `IceLocatorDiscovery` plug-in supports `IceLocatorDiscovery.Trace.Lookup` to + trace lookup requests. + - Instead of succeeding, `Ice::Connection::setAdapter` now raises `Ice.ObjectAdapterDeactivatedException` if the adapter is deactivated. diff --git a/config/PropertyNames.xml b/config/PropertyNames.xml index 24181187657..7fcaf024df8 100644 --- a/config/PropertyNames.xml +++ b/config/PropertyNames.xml @@ -442,6 +442,7 @@ generated from the section label. <property name="Port"/> <property name="Interface"/> <property name="InstanceName"/> + <property name="Trace.Lookup"/>" </section> <section name="IceBox"> @@ -538,6 +539,7 @@ generated from the section label. <property name="Registry.Trace.Admin" /> <property name="Registry.Trace.Application" /> <property name="Registry.Trace.Adapter" /> + <property name="Registry.Trace.Discovery" /> <property name="Registry.Trace.Locator" /> <property name="Registry.Trace.Node" /> <property name="Registry.Trace.Object" /> diff --git a/config/makeprops.py b/config/makeprops.py index 232c18be88d..964696c57d5 100755 --- a/config/makeprops.py +++ b/config/makeprops.py @@ -340,7 +340,7 @@ class CppPropertyHandler(PropertyHandler): def closeFiles(self): self.hFile.write(cppHeaderPostamble % {'classname' : self.className}) - self.cppFile.write("\nconst IceInternal::PropertyArray "\ + self.cppFile.write("const IceInternal::PropertyArray "\ "IceInternal::%(classname)s::validProps[] =\n" % \ {'classname' : self.className}) @@ -350,13 +350,13 @@ class CppPropertyHandler(PropertyHandler): self.cppFile.write(" IceInternal::PropertyArray(0,0)\n"); self.cppFile.write("};\n\n") - self.cppFile.write("\nconst char* IceInternal::%(classname)s::clPropNames[] =\n" % \ + self.cppFile.write("const char* IceInternal::%(classname)s::clPropNames[] =\n" % \ {'classname' : self.className}) self.cppFile.write("{\n") for s in self.cmdLineOptions: self.cppFile.write(" \"%s\",\n" % s) self.cppFile.write(" 0\n") - self.cppFile.write("};\n\n") + self.cppFile.write("};\n") self.hFile.close() self.cppFile.close() @@ -377,7 +377,7 @@ class CppPropertyHandler(PropertyHandler): def newSection(self): self.hFile.write(" static const PropertyArray %sProps;\n" % self.currentSection) - self.cppFile.write("const IceInternal::Property %sPropsData[] = \n" % self.currentSection) + self.cppFile.write("const IceInternal::Property %sPropsData[] =\n" % self.currentSection) self.cppFile.write("{\n") def closeSection(self): @@ -414,7 +414,7 @@ class JavaPropertyHandler(PropertyHandler): self.srcFile.write(javaPreamble % {'inputfile' : self.inputfile, 'classname' : self.className}) def closeFiles(self): - self.srcFile.write("\n public static final Property[] validProps[] =\n") + self.srcFile.write(" public static final Property[] validProps[] =\n") self.srcFile.write(" {\n") for s in self.sections: @@ -454,7 +454,7 @@ class JavaPropertyHandler(PropertyHandler): {"section" : self.currentSection, "pattern": self.fix(propertyName)} ) def newSection(self): - self.srcFile.write(" public static final Property %sProps[] = \n" % self.currentSection) + self.srcFile.write(" public static final Property %sProps[] =\n" % self.currentSection) self.srcFile.write(" {\n") def closeSection(self): diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp index 910a0cc2ace..5e48748d91c 100644 --- a/cpp/src/Ice/PropertyNames.cpp +++ b/cpp/src/Ice/PropertyNames.cpp @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue May 16 17:04:55 2017 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Feb 14 10:24:07 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -422,6 +422,7 @@ const IceInternal::Property IceLocatorDiscoveryPropsData[] = IceInternal::Property("IceLocatorDiscovery.Port", false, 0), IceInternal::Property("IceLocatorDiscovery.Interface", false, 0), IceInternal::Property("IceLocatorDiscovery.InstanceName", false, 0), + IceInternal::Property("IceLocatorDiscovery.Trace.Lookup", false, 0), }; const IceInternal::PropertyArray @@ -1002,6 +1003,7 @@ const IceInternal::Property IceGridPropsData[] = IceInternal::Property("IceGrid.Registry.Trace.Admin", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Application", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Adapter", false, 0), + IceInternal::Property("IceGrid.Registry.Trace.Discovery", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Locator", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Node", false, 0), IceInternal::Property("IceGrid.Registry.Trace.Object", false, 0), diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h index 68085fa56c4..0e04b10933f 100644 --- a/cpp/src/Ice/PropertyNames.h +++ b/cpp/src/Ice/PropertyNames.h @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue May 16 17:04:55 2017 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Feb 14 10:24:07 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index 960995a68d6..a3501a10b08 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -53,8 +53,10 @@ class LookupI : public IceLocatorDiscovery::Lookup { public: - LookupI(const std::string& instanceName, const WellKnownObjectsManagerPtr& wellKnownObjects) : - _instanceName(instanceName), _wellKnownObjects(wellKnownObjects) + LookupI(const std::string& instanceName, + const WellKnownObjectsManagerPtr& wellKnownObjects, + const TraceLevelsPtr& traceLevels) : + _instanceName(instanceName), _wellKnownObjects(wellKnownObjects), _traceLevels(traceLevels) { } @@ -63,11 +65,21 @@ public: { if(!instanceName.empty() && instanceName != _instanceName) { + if(_traceLevels->discovery > 1) + { + Trace out(_traceLevels->logger, _traceLevels->discoveryCat); + out << "ignored discovery lookup for instance name `" << instanceName << "':\nreply = " << reply; + } return; // Ignore. } if(reply) { + if(_traceLevels->discovery > 0) + { + Trace out(_traceLevels->logger, _traceLevels->discoveryCat); + out << "replying to discovery lookup:\nreply = " << reply; + } reply->begin_foundLocator(_wellKnownObjects->getLocator()); } } @@ -82,6 +94,7 @@ private: const string _instanceName; const WellKnownObjectsManagerPtr _wellKnownObjects; + const TraceLevelsPtr _traceLevels; }; class FinderI : public Ice::LocatorFinder @@ -624,7 +637,7 @@ RegistryI::startImpl() { Ice::Identity lookupId = stringToIdentity("IceLocatorDiscovery/Lookup"); discoveryAdapter = _communicator->createObjectAdapter("IceGrid.Registry.Discovery"); - discoveryAdapter->add(new LookupI(_instanceName, _wellKnownObjects), lookupId); + discoveryAdapter->add(new LookupI(_instanceName, _wellKnownObjects, _traceLevels), lookupId); } catch(const Ice::LocalException& ex) { diff --git a/cpp/src/IceGrid/TraceLevels.cpp b/cpp/src/IceGrid/TraceLevels.cpp index 86b4b913e2d..39e54efc1a2 100644 --- a/cpp/src/IceGrid/TraceLevels.cpp +++ b/cpp/src/IceGrid/TraceLevels.cpp @@ -37,6 +37,8 @@ TraceLevels::TraceLevels(const Ice::CommunicatorPtr& communicator, const string& locatorCat("Locator"), session(0), sessionCat("Session"), + discovery(0), + discoveryCat("Discovery"), logger(communicator->getLogger()) { Ice::PropertiesPtr properties = communicator->getProperties(); @@ -53,6 +55,7 @@ TraceLevels::TraceLevels(const Ice::CommunicatorPtr& communicator, const string& const_cast<int&>(patch) = properties->getPropertyAsInt(keyBase + patchCat); const_cast<int&>(locator) = properties->getPropertyAsInt(keyBase + locatorCat); const_cast<int&>(session) = properties->getPropertyAsInt(keyBase + sessionCat); + const_cast<int&>(discovery) = properties->getPropertyAsInt(keyBase + discoveryCat); } TraceLevels::~TraceLevels() diff --git a/cpp/src/IceGrid/TraceLevels.h b/cpp/src/IceGrid/TraceLevels.h index 5a35dcf78af..022929151f3 100644 --- a/cpp/src/IceGrid/TraceLevels.h +++ b/cpp/src/IceGrid/TraceLevels.h @@ -57,6 +57,9 @@ public: const int session; const char* sessionCat; + const int discovery; + const char* discoveryCat; + const Ice::LoggerPtr logger; }; diff --git a/cpp/src/IceLocatorDiscovery/PluginI.cpp b/cpp/src/IceLocatorDiscovery/PluginI.cpp index c8af4b35fd9..d2711f48012 100644 --- a/cpp/src/IceLocatorDiscovery/PluginI.cpp +++ b/cpp/src/IceLocatorDiscovery/PluginI.cpp @@ -115,6 +115,7 @@ private: const int _retryCount; const IceUtil::Time _retryDelay; const IceUtil::TimerPtr _timer; + const int _traceLevel; string _instanceName; bool _warned; @@ -573,6 +574,7 @@ LocatorI::LocatorI(const string& name, _retryCount(p->getPropertyAsIntWithDefault(name + ".RetryCount", 3)), _retryDelay(IceUtil::Time::milliSeconds(p->getPropertyAsIntWithDefault(name + ".RetryDelay", 2000))), _timer(IceInternal::getInstanceTimer(lookup->ice_getCommunicator())), + _traceLevel(p->getPropertyAsInt(name + ".Trace.Lookup")), _instanceName(instanceName), _warned(false), _locator(lookup->ice_getCommunicator()->getDefaultLocator()), @@ -696,6 +698,13 @@ LocatorI::foundLocator(const Ice::LocatorPrxPtr& locator) Lock sync(*this); if(!locator || (!_instanceName.empty() && locator->ice_getIdentity().category != _instanceName)) { + if(_traceLevel > 2) + { + Ice::Trace out(_lookup->ice_getCommunicator()->getLogger(), "Lookup"); + out << "ignoring locator reply: instance name doesn't match\n"; + out << "expected = " << _instanceName; + out << "received = " << locator->ice_getIdentity().category; + } return; } @@ -727,6 +736,16 @@ LocatorI::foundLocator(const Ice::LocatorPrxPtr& locator) _pendingRetryCount = 0; } + if(_traceLevel > 0) + { + Ice::Trace out(_lookup->ice_getCommunicator()->getLogger(), "Lookup"); + out << "locator lookup succeeded:\nlocator = " << locator; + if(!_instanceName.empty()) + { + out << "\ninstance name = " << _instanceName; + } + } + Ice::LocatorPrxPtr l = _pendingRequests.empty() ? _locators[locator->ice_getIdentity().category] : _locator; if(l) { @@ -813,6 +832,15 @@ LocatorI::invoke(const Ice::LocatorPrxPtr& locator, const RequestPtr& request) _pendingRetryCount = _retryCount; try { + if(_traceLevel > 1) + { + Ice::Trace out(_lookup->ice_getCommunicator()->getLogger(), "Lookup"); + out << "looking up locator:\nlookup = " << _lookup; + if(!_instanceName.empty()) + { + out << "\ninstance name = " << _instanceName; + } + } for(vector<pair<LookupPrxPtr, LookupReplyPrxPtr> >::const_iterator l = _lookups.begin(); l != _lookups.end(); ++l) { @@ -836,8 +864,19 @@ LocatorI::invoke(const Ice::LocatorPrxPtr& locator, const RequestPtr& request) } _timer->schedule(ICE_SHARED_FROM_THIS, _timeout); } - catch(const Ice::LocalException&) + catch(const Ice::LocalException& ex) { + if(_traceLevel > 0) + { + Ice::Trace out(_lookup->ice_getCommunicator()->getLogger(), "Lookup"); + out << "locator lookup failed:\nlookup = " << _lookup; + if(!_instanceName.empty()) + { + out << "\ninstance name = " << _instanceName; + } + out << "\n" << ex; + } + for(vector<RequestPtr>::const_iterator p = _pendingRequests.begin(); p != _pendingRequests.end(); ++p) { (*p)->invoke(_voidLocator); @@ -868,6 +907,17 @@ LocatorI::exception(const Ice::LocalException& ex) _warnOnce = false; } + if(_traceLevel > 0) + { + Ice::Trace out(_lookup->ice_getCommunicator()->getLogger(), "Lookup"); + out << "locator lookup failed:\nlookup = " << _lookup; + if(!_instanceName.empty()) + { + out << "\ninstance name = " << _instanceName; + } + out << "\n" << ex; + } + if(_pendingRequests.empty()) { notify(); @@ -891,6 +941,15 @@ LocatorI::runTimerTask() { try { + if(_traceLevel > 1) + { + Ice::Trace out(_lookup->ice_getCommunicator()->getLogger(), "Lookup"); + out << "retrying locator lookup:\nlookup = " << _lookup << "\nretry count = " << _pendingRetryCount; + if(!_instanceName.empty()) + { + out << "\ninstance name = " << _instanceName; + } + } _failureCount = 0; for(vector<pair<LookupPrxPtr, LookupReplyPrxPtr> >::const_iterator l = _lookups.begin(); l != _lookups.end(); ++l) @@ -922,6 +981,16 @@ LocatorI::runTimerTask() _pendingRetryCount = 0; } + if(_traceLevel > 0) + { + Ice::Trace out(_lookup->ice_getCommunicator()->getLogger(), "Lookup"); + out << "locator lookup timed out:\nlookup = " << _lookup; + if(!_instanceName.empty()) + { + out << "\ninstance name = " << _instanceName; + } + } + if(_pendingRequests.empty()) { notify(); diff --git a/csharp/src/Ice/PropertyNames.cs b/csharp/src/Ice/PropertyNames.cs index 80a278bd11c..883dfaa2985 100644 --- a/csharp/src/Ice/PropertyNames.cs +++ b/csharp/src/Ice/PropertyNames.cs @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue May 16 17:04:55 2017 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Feb 14 10:24:07 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -415,6 +415,7 @@ namespace IceInternal new Property(@"^IceLocatorDiscovery\.Port$", false, null), new Property(@"^IceLocatorDiscovery\.Interface$", false, null), new Property(@"^IceLocatorDiscovery\.InstanceName$", false, null), + new Property(@"^IceLocatorDiscovery\.Trace\.Lookup$", false, null), null }; @@ -980,6 +981,7 @@ namespace IceInternal new Property(@"^IceGrid\.Registry\.Trace\.Admin$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Application$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Adapter$", false, null), + new Property(@"^IceGrid\.Registry\.Trace\.Discovery$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Locator$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Node$", false, null), new Property(@"^IceGrid\.Registry\.Trace\.Object$", false, null), diff --git a/csharp/src/IceLocatorDiscovery/PluginI.cs b/csharp/src/IceLocatorDiscovery/PluginI.cs index ee464414b27..29fa15040d2 100644 --- a/csharp/src/IceLocatorDiscovery/PluginI.cs +++ b/csharp/src/IceLocatorDiscovery/PluginI.cs @@ -147,6 +147,7 @@ namespace IceLocatorDiscovery _retryCount = properties.getPropertyAsIntWithDefault(name + ".RetryCount", 3); _retryDelay = properties.getPropertyAsIntWithDefault(name + ".RetryDelay", 2000); _timer = IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer(); + _traceLevel = properties.getPropertyAsInt(name + ".Trace.Lookup"); _instanceName = instanceName; _warned = false; _locator = lookup.ice_getCommunicator().getDefaultLocator(); @@ -261,6 +262,13 @@ namespace IceLocatorDiscovery if(locator == null || (_instanceName.Length > 0 && !locator.ice_getIdentity().category.Equals(_instanceName))) { + if(_traceLevel > 2) + { + StringBuilder s = new StringBuilder("ignoring locator reply: instance name doesn't match\n"); + s.Append("expected = ").Append(_instanceName); + s.Append("received = ").Append(locator.ice_getIdentity().category); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.ToString()); + } return; } @@ -293,6 +301,17 @@ namespace IceLocatorDiscovery _pendingRetryCount = 0; } + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup succeeded:\nlocator = "); + s.Append(locator); + if(_instanceName.Length == 0) + { + s.Append("\ninstance name = ").Append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.ToString()); + } + Ice.LocatorPrx l = null; if(_pendingRequests.Count == 0) { @@ -388,6 +407,17 @@ namespace IceLocatorDiscovery _failureCount = 0; try { + if(_traceLevel > 1) + { + StringBuilder s = new StringBuilder("looking up locator:\nlookup = "); + s.Append(_lookup); + if(_instanceName.Length == 0) + { + s.Append("\ninstance name = ").Append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.ToString()); + } + foreach(var l in _lookups) { l.Key.findLocatorAsync(_instanceName, l.Value).ContinueWith(t => { @@ -403,8 +433,20 @@ namespace IceLocatorDiscovery } _timer.schedule(this, _timeout); } - catch(Ice.LocalException) + catch(Ice.LocalException ex) { + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup failed:\nlookup = "); + s.Append(_lookup); + if(_instanceName.Length == 0) + { + s.Append("\ninstance name = ").Append(_instanceName); + } + s.Append("\n").Append(ex); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.ToString()); + } + foreach(Request req in _pendingRequests) { req.invoke(_voidLocator); @@ -441,6 +483,18 @@ namespace IceLocatorDiscovery _warnOnce = false; } + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup failed:\nlookup = "); + s.Append(_lookup); + if(_instanceName.Length == 0) + { + s.Append("\ninstance name = ").Append(_instanceName); + } + s.Append("\n").Append(ex); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.ToString()); + } + if(_pendingRequests.Count == 0) { Monitor.Pulse(this); @@ -465,6 +519,18 @@ namespace IceLocatorDiscovery { try { + if(_traceLevel > 1) + { + StringBuilder s = new StringBuilder("retrying locator lookup:\nlookup = "); + s.Append(_lookup); + s.Append("retry count = ").Append(_retryCount); + if(_instanceName.Length == 0) + { + s.Append("\ninstance name = ").Append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.ToString()); + } + foreach(var l in _lookups) { l.Key.findLocatorAsync(_instanceName, l.Value); // Send multicast request @@ -478,11 +544,29 @@ namespace IceLocatorDiscovery _pendingRetryCount = 0; } - foreach(Request req in _pendingRequests) + if(_traceLevel > 0) { - req.invoke(_voidLocator); + StringBuilder s = new StringBuilder("locator lookup timed out:\nlookup = "); + s.Append(_lookup); + if(_instanceName.Length == 0) + { + s.Append("\ninstance name = ").Append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.ToString()); + } + + if(_pendingRequests.Count == 0) + { + Monitor.Pulse(this); + } + else + { + foreach(Request req in _pendingRequests) + { + req.invoke(_voidLocator); + } + _pendingRequests.Clear(); } - _pendingRequests.Clear(); _nextRetry = IceInternal.Time.currentMonotonicTimeMillis() + _retryDelay; } } @@ -491,6 +575,7 @@ namespace IceLocatorDiscovery private Dictionary<LookupPrx, LookupReplyPrx> _lookups = new Dictionary<LookupPrx, LookupReplyPrx>(); private int _timeout; private IceInternal.Timer _timer; + private int _traceLevel; private int _retryCount; private int _retryDelay; diff --git a/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java index 316c60073be..2796a04fa97 100644 --- a/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java +++ b/java-compat/src/Ice/src/main/java/IceInternal/PropertyNames.java @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue May 16 17:04:55 2017 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Feb 14 10:24:07 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -415,6 +415,7 @@ public final class PropertyNames new Property("IceLocatorDiscovery\\.Port", false, null), new Property("IceLocatorDiscovery\\.Interface", false, null), new Property("IceLocatorDiscovery\\.InstanceName", false, null), + new Property("IceLocatorDiscovery\\.Trace\\.Lookup", false, null), null }; @@ -980,6 +981,7 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Trace\\.Admin", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Application", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Adapter", false, null), + new Property("IceGrid\\.Registry\\.Trace\\.Discovery", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Node", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Object", false, null), diff --git a/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java b/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java index 276c8433242..d17ec0c77e2 100644 --- a/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java +++ b/java-compat/src/IceLocatorDiscovery/src/main/java/IceLocatorDiscovery/PluginI.java @@ -150,6 +150,7 @@ class PluginI implements Plugin _retryCount = properties.getPropertyAsIntWithDefault(name + ".RetryCount", 3); _retryDelay = properties.getPropertyAsIntWithDefault(name + ".RetryDelay", 2000); _timer = IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer(); + _traceLevel = properties.getPropertyAsInt(name + ".Trace.Lookup"); _instanceName = instanceName; _warned = false; _locator = lookup.ice_getCommunicator().getDefaultLocator(); @@ -265,6 +266,13 @@ class PluginI implements Plugin if(locator == null || (!_instanceName.isEmpty() && !locator.ice_getIdentity().category.equals(_instanceName))) { + if(_traceLevel > 2) + { + StringBuffer s = new StringBuffer("ignoring locator reply: instance name doesn't match\n"); + s.append("expected = ").append(_instanceName); + s.append("received = ").append(locator.ice_getIdentity().category); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } return; } @@ -298,6 +306,17 @@ class PluginI implements Plugin _pendingRetryCount = 0; } + if(_traceLevel > 0) + { + StringBuffer s = new StringBuffer("locator lookup succeeded:\nlocator = "); + s.append(locator); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + Ice.LocatorPrx l = _pendingRequests.isEmpty() ? _locators.get(locator.ice_getIdentity().category) : _locator; if(l != null) @@ -384,6 +403,16 @@ class PluginI implements Plugin _failureCount = 0; try { + if(_traceLevel > 1) + { + StringBuilder s = new StringBuilder("looking up locator:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } for(Map.Entry<LookupPrx, LookupReplyPrx> entry : _lookups.entrySet()) { entry.getKey().begin_findLocator(_instanceName, entry.getValue(), new Ice.Callback() { @@ -406,6 +435,18 @@ class PluginI implements Plugin } catch(Ice.LocalException ex) { + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup failed:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + s.append("\n").append(ex); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + for(Request req : _pendingRequests) { req.invoke(_voidLocator); @@ -441,6 +482,18 @@ class PluginI implements Plugin _warnOnce = false; } + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup failed:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + s.append("\n").append(ex); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + if(_pendingRequests.isEmpty()) { notify(); @@ -467,6 +520,18 @@ class PluginI implements Plugin { try { + if(_traceLevel > 1) + { + StringBuilder s = new StringBuilder("retrying locator lookup:\nlookup = "); + s.append(_lookup); + s.append("retry count = ").append(_retryCount); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + _failureCount = 0; for(Map.Entry<LookupPrx, LookupReplyPrx> entry : _lookups.entrySet()) { @@ -495,6 +560,17 @@ class PluginI implements Plugin _pendingRetryCount = 0; } + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup timed out:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + if(_pendingRequests.isEmpty()) { notify(); @@ -518,6 +594,7 @@ class PluginI implements Plugin private final int _timeout; private java.util.concurrent.Future<?> _future; private final java.util.concurrent.ScheduledExecutorService _timer; + private final int _traceLevel; private final int _retryCount; private final int _retryDelay; diff --git a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java index ee67ab7c1f0..5f6f40e12ef 100644 --- a/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java +++ b/java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue May 16 17:04:55 2017 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Feb 14 10:24:07 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! @@ -415,6 +415,7 @@ public final class PropertyNames new Property("IceLocatorDiscovery\\.Port", false, null), new Property("IceLocatorDiscovery\\.Interface", false, null), new Property("IceLocatorDiscovery\\.InstanceName", false, null), + new Property("IceLocatorDiscovery\\.Trace\\.Lookup", false, null), null }; @@ -980,6 +981,7 @@ public final class PropertyNames new Property("IceGrid\\.Registry\\.Trace\\.Admin", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Application", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Adapter", false, null), + new Property("IceGrid\\.Registry\\.Trace\\.Discovery", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Locator", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Node", false, null), new Property("IceGrid\\.Registry\\.Trace\\.Object", false, null), diff --git a/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java index 91141dbc6d4..7e0a8fc85c3 100644 --- a/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java +++ b/java/src/IceLocatorDiscovery/src/main/java/com/zeroc/IceLocatorDiscovery/PluginI.java @@ -146,6 +146,7 @@ class PluginI implements Plugin _retryCount = properties.getPropertyAsIntWithDefault(name + ".RetryCount", 3); _retryDelay = properties.getPropertyAsIntWithDefault(name + ".RetryDelay", 2000); _timer = com.zeroc.IceInternal.Util.getInstance(lookup.ice_getCommunicator()).timer(); + _traceLevel = properties.getPropertyAsInt(name + ".Trace.Lookup"); _instanceName = instanceName; _warned = false; _locator = lookup.ice_getCommunicator().getDefaultLocator(); @@ -262,6 +263,13 @@ class PluginI implements Plugin if(locator == null || (!_instanceName.isEmpty() && !locator.ice_getIdentity().category.equals(_instanceName))) { + if(_traceLevel > 2) + { + StringBuffer s = new StringBuffer("ignoring locator reply: instance name doesn't match\n"); + s.append("expected = ").append(_instanceName); + s.append("received = ").append(locator.ice_getIdentity().category); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } return; } @@ -295,6 +303,17 @@ class PluginI implements Plugin _pendingRetryCount = 0; } + if(_traceLevel > 0) + { + StringBuffer s = new StringBuffer("locator lookup succeeded:\nlocator = "); + s.append(locator); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + com.zeroc.Ice.LocatorPrx l = _pendingRequests.isEmpty() ? _locators.get(locator.ice_getIdentity().category) : _locator; if(l != null) @@ -381,6 +400,16 @@ class PluginI implements Plugin _pendingRetryCount = _retryCount; try { + if(_traceLevel > 1) + { + StringBuilder s = new StringBuilder("looking up locator:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } for(Map.Entry<LookupPrx, LookupReplyPrx> entry : _lookups.entrySet()) { entry.getKey().findLocatorAsync(_instanceName, entry.getValue()).whenComplete((v, ex) -> { @@ -394,6 +423,18 @@ class PluginI implements Plugin } catch(com.zeroc.Ice.LocalException ex) { + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup failed:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + s.append("\n").append(ex); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + for(Request req : _pendingRequests) { req.invoke(_voidLocator); @@ -428,6 +469,18 @@ class PluginI implements Plugin _warnOnce = false; } + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup failed:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + s.append("\n").append(ex); + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + if(_pendingRequests.isEmpty()) { notify(); @@ -454,6 +507,18 @@ class PluginI implements Plugin { try { + if(_traceLevel > 1) + { + StringBuilder s = new StringBuilder("retrying locator lookup:\nlookup = "); + s.append(_lookup); + s.append("retry count = ").append(_retryCount); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + _failureCount = 0; for(Map.Entry<LookupPrx, LookupReplyPrx> entry : _lookups.entrySet()) { @@ -473,6 +538,17 @@ class PluginI implements Plugin _pendingRetryCount = 0; } + if(_traceLevel > 0) + { + StringBuilder s = new StringBuilder("locator lookup timed out:\nlookup = "); + s.append(_lookup); + if(!_instanceName.isEmpty()) + { + s.append("\ninstance name = ").append(_instanceName); + } + _lookup.ice_getCommunicator().getLogger().trace("Lookup", s.toString()); + } + if(_pendingRequests.isEmpty()) { notify(); @@ -496,6 +572,7 @@ class PluginI implements Plugin private final int _timeout; private java.util.concurrent.Future<?> _future; private final java.util.concurrent.ScheduledExecutorService _timer; + private final int _traceLevel; private final int _retryCount; private final int _retryDelay; diff --git a/js/src/Ice/PropertyNames.js b/js/src/Ice/PropertyNames.js index dfc1e5395bd..6023ab1ef18 100644 --- a/js/src/Ice/PropertyNames.js +++ b/js/src/Ice/PropertyNames.js @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** -// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue May 16 17:04:55 2017 +// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Feb 14 10:24:07 2018 // IMPORTANT: Do not edit this file -- any edits made here will be lost! diff --git a/scripts/IceGridUtil.py b/scripts/IceGridUtil.py index 036164c4158..38b7184821e 100644 --- a/scripts/IceGridUtil.py +++ b/scripts/IceGridUtil.py @@ -75,6 +75,7 @@ class IceGridNode(ProcessFromBinDir, Server): os.mkdir(self.dbdir) def teardown(self, current, success): + Server.teardown(self, current, success) # Remove the database directory tree try: shutil.rmtree(self.dbdir) @@ -129,6 +130,7 @@ class IceGridRegistry(ProcessFromBinDir, Server): os.mkdir(self.dbdir) def teardown(self, current, success): + Server.teardown(self, current, success) # Remove the database directory tree try: shutil.rmtree(self.dbdir) diff --git a/scripts/Util.py b/scripts/Util.py index c6c73628f6a..79476431c63 100644 --- a/scripts/Util.py +++ b/scripts/Util.py @@ -1909,7 +1909,8 @@ class LocalProcessController(ProcessController): def teardown(self, current, success): if self.traceFile: if success or current.driver.isInterrupted(): - os.remove(self.traceFile) +# os.remove(self.traceFile) + pass else: current.writeln("saved {0}".format(self.traceFile)) @@ -1943,9 +1944,12 @@ class LocalProcessController(ProcessController): if not isinstance(process.getMapping(current), JavaScriptMapping): traceProps = process.getEffectiveTraceProps(current) if traceProps: + if "Ice.ProgramName" in props: + programName = props["Ice.ProgramName"] + else: + programName = process.exe or current.testcase.getProcessType(process) traceFile = os.path.join(current.testsuite.getPath(), - "{0}-{1}.log".format(process.exe or current.testcase.getProcessType(process), - time.strftime("%m%d%y-%H%M"))) + "{0}-{1}.log".format(programName, time.strftime("%m%d%y-%H%M"))) traceProps["Ice.StdErr"] = traceFile props.update(traceProps) diff --git a/scripts/tests/IceGrid/simple.py b/scripts/tests/IceGrid/simple.py index 002ac0cf89b..23ae61a930c 100644 --- a/scripts/tests/IceGrid/simple.py +++ b/scripts/tests/IceGrid/simple.py @@ -16,6 +16,9 @@ serverProps = { registryProps = { "IceGrid.Registry.DynamicRegistration" : 1 } +registryTraceProps = { + "IceGrid.Registry.Trace.Discovery": 2 +} clientProps = lambda process, current: { "IceLocatorDiscovery.Timeout": 50, @@ -23,6 +26,7 @@ clientProps = lambda process, current: { "IceLocatorDiscovery.Interface": "" if isinstance(platform, Linux) else "::1" if current.config.ipv6 else "127.0.0.1", "IceLocatorDiscovery.Port": current.driver.getTestPort(99), } +clientTraceProps = { "IceLocatorDiscovery.Trace.Lookup" : 3 } # Filter-out the warning about invalid lookup proxy outfilters = [ lambda x: re.sub("-! .* warning: .*failed to lookup locator.*\n", "", x), @@ -30,10 +34,12 @@ outfilters = [ lambda x: re.sub("-! .* warning: .*failed to lookup locator.*\n", TestSuite(__name__, [ IceGridTestCase("without deployment", application=None, - icegridregistry=[IceGridRegistryMaster(props=registryProps), - IceGridRegistrySlave(1, props=registryProps), - IceGridRegistrySlave(2, props=registryProps)], - client=ClientServerTestCase(client=IceGridClient(props=clientProps, outfilters=outfilters), + icegridregistry=[IceGridRegistryMaster(props=registryProps, traceProps=registryTraceProps), + IceGridRegistrySlave(1, props=registryProps, traceProps=registryTraceProps), + IceGridRegistrySlave(2, props=registryProps, traceProps=registryTraceProps)], + client=ClientServerTestCase(client=IceGridClient(props=clientProps, + outfilters=outfilters, + traceProps=clientTraceProps), server=IceGridServer(props=serverProps))), IceGridTestCase("with deployment", client=IceGridClient(args=["--with-deploy"])) ], multihost=False) |