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

Retry Annotation fails with NullPointerException #4355

Closed
Aditya-Jaitly opened this issue Jun 9, 2022 · 5 comments
Closed

Retry Annotation fails with NullPointerException #4355

Aditya-Jaitly opened this issue Jun 9, 2022 · 5 comments
Assignees
Labels
bug Something isn't working cdi CDI fault-tolerance P2
Projects

Comments

@Aditya-Jaitly
Copy link

Aditya-Jaitly commented Jun 9, 2022

Environment Details

  • Helidon Version: 2.5.0
  • Helidon MP
  • JDK version: 11
  • OS: Oracle Linux
  • Docker version (if applicable): NA

Problem Description

Retry Annotation when applied on Rest client throws NullPointerException even when retry shouldnt be triggered. Expected Behaviour: Retry when Rest call fails.
Easily Reproducible
Stack Trace:

java.lang.NullPointerException
        at io.helidon.microprofile.faulttolerance.MethodInvoker.updateCounter(MethodInvoker.java:762)
        at io.helidon.microprofile.faulttolerance.MethodInvoker.updateMetricsAfter(MethodInvoker.java:655)
        at io.helidon.microprofile.faulttolerance.MethodInvoker.get(MethodInvoker.java:436)
        at io.helidon.microprofile.faulttolerance.CommandInterceptor.interceptCommand(CommandInterceptor.java:54)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73)
        at org.jboss.weld.interceptor.proxy.WeldInvocationContextImpl.invokeNext(WeldInvocationContextImpl.java:92)
        at org.jboss.weld.interceptor.proxy.WeldInvocationContextImpl.proceed(WeldInvocationContextImpl.java:124)
        at org.jboss.weld.bean.InterceptorImpl.intercept(InterceptorImpl.java:105)
        at org.glassfish.jersey.microprofile.restclient.InterceptorInvocationContext$InvocationInterceptor.intercept(InterceptorInvocationContext.java:136)
        at org.glassfish.jersey.microprofile.restclient.InterceptorInvocationContext.proceed(InterceptorInvocationContext.java:108)
        at org.glassfish.jersey.microprofile.restclient.RestClientModel.invokeMethod(RestClientModel.java:69)
        at org.glassfish.jersey.microprofile.restclient.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:70)
        at com.sun.proxy.$Proxy126.createAssetType(Unknown Source)
        at com.oracle.ecp.device.service.AssetTypeService.createAssetType(AssetTypeService.java:103)
        at com.oracle.ecp.device.service.AssetTypeService.createAssetTypes(AssetTypeService.java:59)
        at com.oracle.ecp.device.service.AssetTypeService$Proxy$_$$_WeldClientProxy.createAssetTypes(Unknown Source)
        at com.oracle.ecp.device.service.impl.TenantOnboardingServiceImpl.onboardTenant(TenantOnboardingServiceImpl.java:18)
        at com.oracle.ecp.device.service.impl.TenantOnboardingServiceImpl$Proxy$_$$_WeldClientProxy.onboardTenant(Unknown Source)
        at com.oracle.ecp.device.controller.TenantOnboardingControllerV1.onboardTenant(TenantOnboardingControllerV1.java:46)
        at com.oracle.ecp.device.controller.TenantOnboardingControllerV1$Proxy$_$$_WeldClientProxy.onboardTenant(Unknown Source)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:124)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:167)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:79)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:475)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:397)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
        at io.helidon.webserver.jersey.JerseySupport$JerseyHandler.lambda$doAccept$4(JerseySupport.java:327)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.common.context.ContextAwareExecutorImpl.lambda$wrap$7(ContextAwareExecutorImpl.java:154)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

Steps to reproduce

Create Rest Client, add Retry annotation, and trigger the rest client.

        @POST
	@Retry
	@Path("/dummyUrl/{orgId}")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	Response createAssetType(@HeaderParam("Authorization") String authorization, @PathParam("orgId") String orgId,
			InputStream input);
@github-actions github-actions bot added this to Triage in Backlog Jun 9, 2022
@spericas spericas self-assigned this Jun 9, 2022
@spericas
Copy link
Member

spericas commented Jun 9, 2022

I'm not sure we have any integration tests between RestClient and FT. Issue here is likely that the proxy/bean created isn't known to CDI or the FT CDI extension. Likely related to issue #3549.

@spericas
Copy link
Member

spericas commented Jun 9, 2022

@Aditya-Jaitly How is your RestClient instance created?

@m0mus m0mus added bug Something isn't working P2 labels Jun 9, 2022
@m0mus m0mus moved this from Triage to High priority in Backlog Jun 9, 2022
@Aditya-Jaitly
Copy link
Author

Aditya-Jaitly commented Jun 9, 2022

@Aditya-Jaitly How is your RestClient instance created?
Created Using Builder

IoTRestClient tenantRestClient = RestClientBuilder.newBuilder().baseUri(new URI(tenantBaseURI)).build(RestClient.class);

And RestClient interface contains

       @POST
	@Retry
	@Path("/dummyUrl/{orgId}")
	@Consumes(MediaType.APPLICATION_JSON)
	@Produces(MediaType.APPLICATION_JSON)
	Response createAssetType(@HeaderParam("Authorization") String authorization, @PathParam("orgId") String orgId,
			InputStream input);

@spericas
Copy link
Member

@Aditya-Jaitly Are you able to share some more code? Perhaps a small reproducible that shows the exception?

@spericas spericas moved this from High priority to In Progress in Backlog Jul 28, 2022
@m0mus m0mus moved this from In Progress to Sprint Scope in Backlog Jul 28, 2022
@spericas
Copy link
Member

spericas commented Aug 2, 2022

PR #4355
PR #4615

@spericas spericas closed this as completed Aug 2, 2022
Backlog automation moved this from Sprint Scope to Closed Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cdi CDI fault-tolerance P2
Projects
Backlog
  
Closed
Development

No branches or pull requests

3 participants