Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraalVM Reachability Metadata Lose #11902

Closed
zzhujing opened this issue Apr 1, 2024 · 5 comments · Fixed by #11940
Closed

GraalVM Reachability Metadata Lose #11902

zzhujing opened this issue Apr 1, 2024 · 5 comments · Fixed by #11940
Labels
area/Client Related to Nacos Client SDK contribution welcome

Comments

@zzhujing
Copy link

zzhujing commented Apr 1, 2024

Is your feature request related to a problem? Please describe.

  1. dubbo registry with nacos client 2.3.1
  2. build native-image by dubbo-maven-plugin
  3. report lose some metadata when destroy dubbo invoke
2024-04-01T10:45:23.233+08:00  WARN 3508 --- [ionShutdownHook] o.a.d.r.nacos.NacosNamingServiceWrapper  :  [DUBBO] Failed to request nacos naming server. Dubbo will try to retry in 10. Try times: 1, dubbo version: 3.3.0-beta.2, current host: 192.168.64.1, error code: 1-37. This may be caused by , go to https://dubbo.apache.org/faq/1/37 to find instructions. 

com.alibaba.nacos.api.exception.NacosException: org.graalvm.nativeimage.MissingReflectionRegistrationError: The program tried to reflectively invoke method public int com.alibaba.nacos.api.naming.remote.request.ServiceListRequest.getPageNo() without it being registered for runtime reflection. Add public int com.alibaba.nacos.api.naming.remote.request.ServiceListRequest.getPageNo() to the reflection metadata to solve this problem. See https://www.graalvm.org/latest/reference-manual/native-image/metadata/#reflection for help.
        at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:698) ~[biz:na]
        at com.alibaba.nacos.common.remote.client.RpcClient.request(RpcClient.java:626) ~[biz:na]
        at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.requestToServer(NamingGrpcClientProxy.java:450) ~[biz:na]
        at com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy.getServiceList(NamingGrpcClientProxy.java:366) ~[biz:na]
        at com.alibaba.nacos.client.naming.remote.NamingClientProxyDelegate.getServiceList(NamingClientProxyDelegate.java:162) ~[na:na]
        at com.alibaba.nacos.client.naming.NacosNamingService.getServicesOfServer(NacosNamingService.java:458) ~[biz:na]
        at com.alibaba.nacos.client.naming.NacosNamingService.getServicesOfServer(NacosNamingService.java:446) ~[biz:na]
        at org.apache.dubbo.registry.nacos.NacosNamingServiceWrapper.lambda$getServicesOfServer$20(NacosNamingServiceWrapper.java:291) ~[na:na]
        at org.apache.dubbo.registry.nacos.NacosNamingServiceWrapper.apply(NacosNamingServiceWrapper.java:448) ~[na:na]
        at org.apache.dubbo.registry.nacos.NacosNamingServiceWrapper.getServicesOfServer(NacosNamingServiceWrapper.java:291) ~[na:na]
        at org.apache.dubbo.registry.nacos.NacosServiceDiscovery.lambda$getServices$3(NacosServiceDiscovery.java:144) ~[na:na]
        at org.apache.dubbo.common.function.ThrowableFunction.execute(ThrowableFunction.java:52) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.common.function.ThrowableFunction.execute(ThrowableFunction.java:69) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.registry.nacos.NacosServiceDiscovery.getServices(NacosServiceDiscovery.java:143) ~[na:na]
        at org.apache.dubbo.registry.client.ServiceDiscovery.isAvailable(ServiceDiscovery.java:100) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.registry.client.ServiceDiscoveryRegistry.isAvailable(ServiceDiscoveryRegistry.java:315) ~[na:na]
        at org.apache.dubbo.registry.ListenerRegistryWrapper.isAvailable(ListenerRegistryWrapper.java:49) ~[na:na]
        at org.apache.dubbo.registry.integration.DynamicDirectory.destroy(DynamicDirectory.java:317) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.registry.client.ServiceDiscoveryRegistryDirectory.destroy(ServiceDiscoveryRegistryDirectory.java:178) ~[na:na]
        at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.destroy(AbstractClusterInvoker.java:130) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.destroy(MockClusterInvoker.java:90) ~[na:na]
        at org.apache.dubbo.rpc.cluster.support.wrapper.ScopeClusterInvoker.destroy(ScopeClusterInvoker.java:124) ~[na:na]
        at org.apache.dubbo.registry.client.migration.MigrationInvoker.destroy(MigrationInvoker.java:343) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:61) ~[na:na]
        at jdk.proxy4/jdk.proxy4.$Proxy49.$destroy(Unknown Source) ~[na:na]
        at org.apache.dubbo.config.utils.SimpleReferenceCache.destroyReference(SimpleReferenceCache.java:296) ~[na:na]
        at org.apache.dubbo.config.utils.SimpleReferenceCache.lambda$destroyAll$4(SimpleReferenceCache.java:285) ~[na:na]
        at java.base@21.0.2/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603) ~[biz:na]
        at org.apache.dubbo.config.utils.SimpleReferenceCache.destroyAll(SimpleReferenceCache.java:283) ~[na:na]
        at org.apache.dubbo.config.deploy.DefaultModuleDeployer.unreferServices(DefaultModuleDeployer.java:591) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.config.deploy.DefaultModuleDeployer.postDestroy(DefaultModuleDeployer.java:306) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.rpc.model.ModuleModel.onDestroy(ModuleModel.java:111) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.rpc.model.ScopeModel.destroy(ScopeModel.java:122) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onContextClosedEvent(DubboDeployApplicationListener.java:199) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:155) ~[biz:3.3.0-beta.2]
        at org.apache.dubbo.config.spring.context.DubboDeployApplicationListener.onApplicationEvent(DubboDeployApplicationListener.java:52) ~[biz:3.3.0-beta.2]
        at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) ~[na:na]
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) ~[na:na]
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) ~[na:na]
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451) ~[biz:6.1.4]
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384) ~[biz:6.1.4]
        at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1127) ~[biz:6.1.4]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.doClose(ServletWebServerApplicationContext.java:174) ~[biz:3.2.3]
        at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1090) ~[biz:6.1.4]
        at org.springframework.boot.SpringApplicationShutdownHook.closeAndWait(SpringApplicationShutdownHook.java:145) ~[na:na]
        at java.base@21.0.2/java.lang.Iterable.forEach(Iterable.java:75) ~[biz:na]
        at org.springframework.boot.SpringApplicationShutdownHook.run(SpringApplicationShutdownHook.java:114) ~[na:na]
        at java.base@21.0.2/java.lang.Thread.runWith(Thread.java:1596) ~[biz:na]
        at java.base@21.0.2/java.lang.Thread.run(Thread.java:1583) ~[biz:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:833) ~[biz:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:211) ~[na:na]

Describe the solution you'd like

  1. add ServiceListRequest Reachability Medata to reflection-config.json

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

@zzhujing
Copy link
Author

zzhujing commented Apr 1, 2024

resolved When Add Metadata Config Code With Spring-Aot Api

@Configuration
@ImportRuntimeHints(DubboNativeConfig.NacosClientRuntimeHintsRegistrar.class)
public class DubboNativeConfig {
  static class NacosClientRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
    @Override
    public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
      hints.reflection().registerType(ServiceListRequest.class, MemberCategory.values());
      hints.reflection().registerType(ServiceListResponse.class, MemberCategory.values());
    }
  }
}

Can We Add Metadata To META-INF/native-image/**/reflection-config.json ?

@KomachiSion
Copy link
Collaborator

is #11853 fixed?

@zzhujing
Copy link
Author

zzhujing commented Apr 1, 2024

is #11853 fixed? 是#11853固定?

it seems like lose ServiceListRequest/ServiceListResponse Metadata , i can't find in #11853

@KomachiSion
Copy link
Collaborator

@zzhujing Welcome submit PR to fix like #11860

@KomachiSion KomachiSion added contribution welcome area/Client Related to Nacos Client SDK and removed status/need feedback labels Apr 3, 2024
@hnyyghk
Copy link
Contributor

hnyyghk commented Apr 9, 2024

@hnyyghk will solve it@

KomachiSion pushed a commit that referenced this issue Apr 11, 2024
* Update request reflect-config.json

add deletion graalvm reflect config

* Update response reflect-config.json

add deletion graalvm reflect config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/Client Related to Nacos Client SDK contribution welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants