diff --git a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java
index b99e4be..24d9a33 100644
--- a/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java
+++ b/providers/lldp/src/main/java/org/onosproject/provider/lldp/impl/LldpLinkProvider.java
@@ -741,14 +741,24 @@
                     if (isStale(e.getValue())) {
                         if (useStaleLinkAge) {
                             providerService.linkVanished(new DefaultLinkDescription(e.getKey().src(),
-
                                                                                 e.getKey().dst(),
                                                                                 DIRECT));
                             return true;
                         }
-                        log.warn("VanishStaleLinkAge feature is disabled, " +
-                                "not bringing down link src {} dst {} with expired StaleLinkAge",
-                                e.getKey().src(), e.getKey().dst());
+                        // if one of the device is not available - let's prune the link
+                        if (!deviceService.isAvailable(e.getKey().src().deviceId()) ||
+                                !deviceService.isAvailable(e.getKey().dst().deviceId())) {
+                            return true;
+                        }
+                        // if one of the ports is not enable - let's prune the link
+                        Port srcPort = deviceService.getPort(e.getKey().src());
+                        Port dstPort = deviceService.getPort(e.getKey().dst());
+                        if (!srcPort.isEnabled() || !dstPort.isEnabled()) {
+                            return true;
+                        }
+                        log.trace("VanishStaleLinkAge feature is disabled, " +
+                                        "not bringing down link src {} dst {} with expired StaleLinkAge",
+                                 e.getKey().src(), e.getKey().dst());
                     }
                     return false;
                 }).clear();
diff --git a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
index e743af5..578e1c1 100644
--- a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
+++ b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
@@ -370,17 +370,30 @@
      */
     @Override
     public void run(Timeout t) {
-        if (isStopped()) {
-            return;
-        }
-
-        if (context.mastershipService().isLocalMaster(deviceId)) {
-            log.trace("Sending probes from {}", deviceId);
-            ImmutableMap.copyOf(portMap).forEach(this::sendProbes);
-        }
-
-        if (!isStopped()) {
-            timeout = t.timer().newTimeout(this, context.probeRate(), MILLISECONDS);
+        try {
+            // Check first if it has been stopped
+            if (isStopped()) {
+                return;
+            }
+            // Verify if we are still the master
+            if (context.mastershipService().isLocalMaster(deviceId)) {
+                log.trace("Sending probes from {}", deviceId);
+                ImmutableMap.copyOf(portMap).forEach(this::sendProbes);
+            }
+        } catch (Exception e) {
+            // Catch all exceptions to avoid timer task being cancelled
+            if (!isStopped()) {
+                // Error condition
+                log.error("Exception thrown during link discovery process", e);
+            } else {
+                // Provider is shutting down, the error can be ignored
+                log.trace("Shutting down, ignoring error", e);
+            }
+        } finally {
+            // if it has not been stopped - re-schedule itself
+            if (!isStopped()) {
+                timeout = t.timer().newTimeout(this, context.probeRate(), MILLISECONDS);
+            }
         }
     }
 
