You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by dg...@apache.org on 2019/02/11 17:22:30 UTC

[trafficcontrol] branch 3.0.x updated: Improve handling of faulty CRConfig DS-server assignments in TR (#3323)

This is an automated email from the ASF dual-hosted git repository.

dgelinas pushed a commit to branch 3.0.x
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/3.0.x by this push:
     new b154837  Improve handling of faulty CRConfig DS-server assignments in TR (#3323)
b154837 is described below

commit b154837fa9830ecfd72203f9f0be79d9c4be33be
Author: Rawlin Peters <Ra...@gmail.com>
AuthorDate: Mon Feb 11 10:22:26 2019 -0700

    Improve handling of faulty CRConfig DS-server assignments in TR (#3323)
    
    If a server has a reference to a delivery service but the delivery
    service does not exist (i.e.
    crconfig["contentServers"]["cache1"]["deliveryServices"] contains a DS
    xml_id that doesn't have a matching delivery service in
    crconfig["deliveryServices"]) Traffic Router should log a warning for
    that error and continue rather than throwing a NullPointerException.
    
    The bad generation of the CRConfig will be fixed separately.
    
    (cherry picked from commit a79aad683cf433eaa217ac21d9bb6bc67a652e32)
---
 .../cdn/traffic_control/traffic_router/core/dns/ZoneManager.java      | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/dns/ZoneManager.java b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/dns/ZoneManager.java
index 2703dcb..88cd44b 100644
--- a/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/dns/ZoneManager.java
+++ b/traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/dns/ZoneManager.java
@@ -620,6 +620,10 @@ public class ZoneManager extends Resolver {
 		for (final Cache c : data.getCacheMap().values()) {
 			for (final DeliveryServiceReference dsr : c.getDeliveryServices()) {
 				final DeliveryService ds = data.getDeliveryService(dsr.getDeliveryServiceId());
+				if (ds == null) {
+					LOGGER.warn("Content server " + c.getFqdn() + " has delivery service " + dsr.getDeliveryServiceId() + " assigned, but the delivery service was not found. Skipping.");
+					continue;
+				}
 				final String fqdn = dsr.getFqdn();
 				final String[] parts = fqdn.split("\\.", 2);
 				final String host = parts[0];