Closed smalenfant closed 6 years ago
The default in Traffic Router is set to 1, if and only if the dispersion JSON object is null.
There are two issues to fix in Traffic Router:
1) line 43 of ConsistentHasher is what is affected when dispersion is set to 0; this implies we must support a limit of 0 (unlimited, randomize across the entire cachegroup), or ignore a setting of 0 and replace it with the default of 1 and only use dispersions that are >=1. 2) the blind get of index 0 on a list on line 31 of ConsistentHasher is what causes the exception below.
Exception:
SEVERE: Servlet.service() for servlet default threw exception
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.comcast.cdn.traffic_control.traffic_router.core.hash.ConsistentHasher.selectHashable(ConsistentHasher.java:31)
at com.comcast.cdn.traffic_control.traffic_router.core.router.TrafficRouter.singleRoute(TrafficRouter.java:531)
at com.comcast.cdn.traffic_control.traffic_router.core.router.TrafficRouter.route(TrafficRouter.java:497)
at com.comcast.cdn.traffic_control.traffic_router.core.http.RouterFilter.writeHttpResponse(RouterFilter.java:87)
at com.comcast.cdn.traffic_control.traffic_router.core.http.RouterFilter.doFilterInternal(RouterFilter.java:77)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:875)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:756)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2334)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)```
These are the defaults used by the Traffic Portal for each delivery service "category"
Notice that only "HTTP*" delivery services have a value set for initial dispersion, this means that the other categories (DNS, ANY_MAP and STEERING) will send a json request minus a key for initialDispersion which will result in the API simply putting initial_dispersion=NULL into the database.
If putting initial_dispersion=NULL in the database for a DS is in fact a problem, we can discuss how to prevent that in the TP/API
Ok, so it sounds like the only type of DS that cares about initialDispersion is HTTP* and in that case it has to be 1 (no dispersion) or greater.
@elsloo said now that the TP/TO work is done, the TR work is less of a priority and we can circle back to it so please leave this issue open ofter #1742 is merged.
Created a new delivery service with Traffic Portal, the initial dispersion was not set (value was 0 in CR-Config), causing Traffic Router to return status code 500.
Version: traffic_portal-2.2.0-7469.e9407978.el7.x86_64
Probably need to fix Traffic Router as well for this condition. Should 0 be off as well?