-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
None
We currently cache parsed configuration data for policies in the gateway. If two different versions of the same plugin policy are being used at the same time, and if they use the exact same configuration data, then an invalid instance of the config object may be sent to the policy impl. This results in:
java.lang.ClassCastException: io.apiman.plugins.jsonp_policy.beans.JsonpConfigBean cannot be cast to io.apiman.plugins.jsonp_policy.beans.JsonpConfigBean
at io.apiman.plugins.jsonp_policy.JsonpPolicy.doApply(JsonpPolicy.java:27)
at io.apiman.gateway.engine.policies.AbstractMappedPolicy.apply(AbstractMappedPolicy.java:71)
at io.apiman.gateway.engine.policy.RequestChain.applyPolicy(RequestChain.java:65)
at io.apiman.gateway.engine.policy.Chain.doApply(Chain.java:148)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$2.handle(ServiceRequestExecutorImpl.java:247)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$2.handle(ServiceRequestExecutorImpl.java:198)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$5.handle(ServiceRequestExecutorImpl.java:392)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$5.handle(ServiceRequestExecutorImpl.java:362)
at io.apiman.gateway.engine.policy.PolicyFactoryImpl.loadPolicy(PolicyFactoryImpl.java:81)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl.loadPolicies(ServiceRequestExecutorImpl.java:362)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl.access$1400(ServiceRequestExecutorImpl.java:77)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$3.handle(ServiceRequestExecutorImpl.java:270)
at io.apiman.gateway.engine.impl.ServiceRequestExecutorImpl$3.handle(ServiceRequestExecutorImpl.java:255)
at io.apiman.gateway.engine.impl.SecureRegistryWrapper$1.handle(SecureRegistryWrapper.java:107)
at io.apiman.gateway.engine.impl.SecureRegistryWrapper$1.handle(SecureRegistryWrapper.java:97)
at io.apiman.gateway.engine.es.ESRegistry$10.completed(ESRegistry.java:413)
at io.apiman.gateway.engine.es.ESRegistry$10.completed(ESRegistry.java:407)
The solution is to ensure that caching of config data takes into account the policy as well as the policy config data as the key into the cache.