From: Michael Vorburger Date: Tue, 8 May 2018 14:59:24 +0000 (+0200) Subject: add additional (debug) logging to AbstractStreamWriterGenerator X-Git-Tag: release/fluorine~211 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=d6f766e56a8acf87bafdb1a97791bf3400636f9a;hp=ebad4b233a0f77232b48e4c1958ca0c15c132930;p=mdsal.git add additional (debug) logging to AbstractStreamWriterGenerator * LOG.debug() in generateSerializer() to see if in a load test scenario that ever gets called twice for the same type (it should not) due to a concurrency bug I'm not seeing. * reduce the only other LOG.debug() in that class to trace() because that one will happen more often (constantly?) and make it hard to see the other one. * log onBindingRuntimeContextUpdated() on the off chance that changing the BindingRuntimeContext somehow could cause this suspected concurrency issue. * log constructor to better understand the lifecycle of AbstractStreamWriterGenerator in production. * add Guava Cache removalListener with logging to see if this is caused by eviction by GC due to .weakKeys() - ACK to tpantelis for this hunch. JIRA: MDSAL-213 Change-Id: I2416131fe140ee483cc93740480ee0e37f0ce130 Signed-off-by: Michael Vorburger --- diff --git a/binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/AbstractStreamWriterGenerator.java b/binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/AbstractStreamWriterGenerator.java index d8ade5e439..325446040e 100644 --- a/binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/AbstractStreamWriterGenerator.java +++ b/binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/gen/impl/AbstractStreamWriterGenerator.java @@ -83,7 +83,11 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement }; javassist.appendClassLoaderIfMissing(DataObjectSerializerPrototype.class.getClassLoader()); } - this.implementations = CacheBuilder.newBuilder().weakKeys().build(new SerializerImplementationLoader()); + this.implementations = CacheBuilder.newBuilder() + .removalListener(notification -> LOG.debug("onRemoval: cause={}, wasEvicted={}", + notification.getCause(), notification.wasEvicted())) + .weakKeys().build(new SerializerImplementationLoader()); + LOG.debug("AbstractStreamWriterGenerator constructor, new instance: {}", this); } @Override @@ -94,6 +98,7 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement @Override public final void onBindingRuntimeContextUpdated(final BindingRuntimeContext runtime) { this.context = runtime; + LOG.debug("onBindingRuntimeContextUpdated() : {}", runtime); } @Override @@ -130,7 +135,7 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement final DataObjectSerializerImplementation obj = (DataObjectSerializerImplementation) cls.getDeclaredMethod(GETINSTANCE_METHOD_NAME).invoke(null); - LOG.debug("Loaded serializer {} for class {}", obj, type); + LOG.trace("Loaded serializer {} for class {}", obj, type); return obj; } @@ -138,6 +143,8 @@ abstract class AbstractStreamWriterGenerator extends AbstractGenerator implement final String serializerName) throws CannotCompileException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, NoSuchFieldException { + LOG.debug("generateSerializer() due to Cache miss: typeName={}, typeClassLoader={}, serializerName={}", + type.getTypeName(), type.getClassLoader(), serializerName); final DataObjectSerializerSource source = generateEmitterSource(type, serializerName); final CtClass poolClass = generateEmitter0(type, source, serializerName); @SuppressWarnings("unchecked")