From 6481a3188fb6a6027f088aa4d2d8834007505ff7 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 21 Sep 2021 11:49:06 +0200 Subject: [PATCH 1/1] Be mindful of non-existent actors We have observed the following splat in SFT: java.lang.NullPointerException: null at org.opendaylight.controller.eos.akka.registry.listener.type.EntityTypeListenerRegistry.onUnregisterListener(EntityTypeListenerRegistry.java:69) ~[bundleFile:?] at akka.actor.typed.javadsl.BuiltReceive.receive(ReceiveBuilder.scala:213) ~[bundleFile:?] This this by checking whether we actually removed a listener. Change-Id: Ifc80ae650db05fd1031af074c694588034f6903a Signed-off-by: Robert Varga --- .../registry/listener/type/EntityTypeListenerRegistry.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/registry/listener/type/EntityTypeListenerRegistry.java b/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/registry/listener/type/EntityTypeListenerRegistry.java index e4f7b48d04..a6183a8f1c 100644 --- a/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/registry/listener/type/EntityTypeListenerRegistry.java +++ b/opendaylight/md-sal/eos-dom-akka/src/main/java/org/opendaylight/controller/eos/akka/registry/listener/type/EntityTypeListenerRegistry.java @@ -66,7 +66,10 @@ public class EntityTypeListenerRegistry extends AbstractBehavior onUnregisterListener(final UnregisterListener command) { LOG.debug("Stopping entity type listener actor for: {}", command.getEntityType()); - spawnedListenerActors.remove(command.getDelegateListener()).tell(TerminateListener.INSTANCE); + final ActorRef actor = spawnedListenerActors.remove(command.getDelegateListener()); + if (actor != null) { + actor.tell(TerminateListener.INSTANCE); + } return this; } -- 2.36.6