[MDSAL-852] IAE during dynamic proxy instantiation Created: 17/Jan/24  Updated: 19/Jan/24  Resolved: 19/Jan/24

Status: Resolved
Project: mdsal
Component/s: Binding codegen, Binding runtime
Affects Version/s: 13.0.0, 10.0.9, 11.0.15, 12.0.4
Fix Version/s: 13.0.0, 11.0.16, 12.0.5

Type: Bug Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: pt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MDSAL-774 Do not use proxies for Action/Rpc ada... Confirmed
relates to MDSAL-772 Remove RpcService Resolved

 Description   

The following splat is encountered in downstream integration:

Caused by: java.lang.IllegalArgumentException: com.google.common.util.concurrent.ListenableFuture referenced from a method is not visible from class loader: org.eclipse.osgi.internal.loader.EquinoxClassLoader @612086b4
        at java.lang.reflect.Proxy$ProxyBuilder.ensureVisible(Proxy.java:884) ~[?:?]
        at java.lang.reflect.Proxy$ProxyBuilder.validateProxyInterfaces(Proxy.java:732) ~[?:?]
        at java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:648) ~[?:?]
        at java.lang.reflect.Proxy$ProxyBuilder.<init>(Proxy.java:656) ~[?:?]
        at java.lang.reflect.Proxy.lambda$getProxyConstructor$0(Proxy.java:429) ~[?:?]
        at jdk.internal.loader.AbstractClassLoaderValue$Memoizer.get(AbstractClassLoaderValue.java:329) ~[?:?]
        at jdk.internal.loader.AbstractClassLoaderValue.computeIfAbsent(AbstractClassLoaderValue.java:205) ~[?:?]
        at java.lang.reflect.Proxy.getProxyConstructor(Proxy.java:427) ~[?:?]
        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:1037) ~[?:?]
        at org.opendaylight.mdsal.binding.dom.adapter.RpcAdapter.<init>(RpcAdapter.java:49) ~[?:?]
        at org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcServiceAdapter.loadAdapter(BindingDOMRpcServiceAdapter.java:43) ~[?:?]
        at org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcServiceAdapter.loadAdapter(BindingDOMRpcServiceAdapter.java:24) ~[?:?]
        at org.opendaylight.mdsal.binding.dom.adapter.AbstractBindingLoadingAdapter$1.load(AbstractBindingLoadingAdapter.java:21) ~[?:?]
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3576) ~[?:?]
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2318) ~[?:?]
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2191) ~[?:?]
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2081) ~[?:?]
        at com.google.common.cache.LocalCache.get(LocalCache.java:4019) ~[?:?]
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4042) ~[?:?]
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5024) ~[?:?]
        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5031) ~[?:?]
        at org.opendaylight.mdsal.binding.dom.adapter.AbstractBindingLoadingAdapter.getAdapter(AbstractBindingLoadingAdapter.java:30) ~[?:?]
        at org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcServiceAdapter.getRpc(BindingDOMRpcServiceAdapter.java:35) ~[?:?]
        at org.opendaylight.mdsal.binding.dom.adapter.osgi.OSGiRpcService.getRpc(OSGiRpcService.java:36) ~[?:?]
        at org.opendaylight.controller.sample.kitchen.impl.KitchenServiceImpl.<init>(KitchenServiceImpl.java:69) ~[?:?]
        ... 45 more

The problem here is that our elimination of yang.binding.RpcService-generated classes done in MDSAL-772, generated binding bundles no longer directly import ListenableFuture's package.



 Comments   
Comment by Robert Varga [ 17/Jan/24 ]

This affects actions as well – and that case affects earlier versions as well. The problem is that if a module defines only actions, earlier releases will not generate the blanket RpcService specialization – and hence the generated code's bundle will not contain imports either.

The real solution is MDSAL-774, but that runs into lifecycle issues (i.e. we need to revoke the generated proxy if the BindingRuntimeContext changes, which brings about dragons).

As a stopgap let's just generate @Override methods, which will bring ListenableFuture back into view and fix this problem.

Comment by Robert Varga [ 18/Jan/24 ]

backported version does not need to touch RPC generation because the ListenableFuture is pulled in by the FooService class.

Generated at Wed Feb 07 20:11:08 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.