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

ClassCastException using autoinstrumentation with Redisson #6033

Closed
gh-axel-czarniak opened this issue May 16, 2022 · 0 comments · Fixed by #6054
Closed

ClassCastException using autoinstrumentation with Redisson #6033

gh-axel-czarniak opened this issue May 16, 2022 · 0 comments · Fixed by #6054
Labels
bug Something isn't working

Comments

@gh-axel-czarniak
Copy link

gh-axel-czarniak commented May 16, 2022

Describe the bug
There is a ClassCastException when using redisson with opentelemetry autoinstrumentation;

java.lang.ClassCastException: class java.util.concurrent.CompletableFuture cannot be cast to class org.redisson.executor.RemotePromise (java.util.concurrent.CompletableFuture is in module java.base of loader 'bootstrap'; org.redisson.executor.RemotePromise is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @255eaa6b)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.decorateException(KafkaMessageListenerContainer.java:2679)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:2649)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeOnMessage(KafkaMessageListenerContainer.java:2609)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeRecordListener(KafkaMessageListenerContainer.java:2536)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeWithRecords(KafkaMessageListenerContainer.java:2427)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:2305)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:1979)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeIfHaveRecords(KafkaMessageListenerContainer.java:1364)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:1355)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:1247)
 java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
 java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
 java.base/java.lang.Thread.run(Thread.java:831)
Suppressed: org.springframework.kafka.listener.ListenerExecutionFailedException: Restored Stack Trace at org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:363)
 org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:92)
 org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:53)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:2629)
Caused by: java.lang.ClassCastException: class java.util.concurrent.CompletableFuture cannot be cast to class org.redisson.executor.RemotePromise (java.util.concurrent.CompletableFuture is in module java.base of loader 'bootstrap'; org.redisson.executor.RemotePromise is in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @255eaa6b)
 org.redisson.RedissonExecutorService.scheduleAsync(RedissonExecutorService.java:932)
 org.redisson.RedissonExecutorService.scheduleAsync(RedissonExecutorService.java:888)
 org.redisson.RedissonExecutorService.schedule(RedissonExecutorService.java:880)
 *.MessageProcessor$$FastClassBySpringCGLIB$$bf2c98e5.invoke(<generated>)
 org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
 org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
 io.micrometer.core.aop.TimedAspect.processWithTimer(TimedAspect.java:192)
 io.micrometer.core.aop.TimedAspect.timedMethod(TimedAspect.java:170)
 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 java.base/java.lang.reflect.Method.invoke(Method.java:568)
 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
 org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
 org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
 org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
 com.ioterop.anchorage.devicemanagement.application.messaging.MessageProcessor$$EnhancerBySpringCGLIB$$f2aa5ab.process(<generated>)
 com.ioterop.anchorage.devicemanagement.infrastructure.messaging.coap.KafkaCoapConsumer.receiveMessage(KafkaCoapConsumer.java:48)
 com.ioterop.anchorage.devicemanagement.infrastructure.messaging.coap.KafkaCoapConsumer$$FastClassBySpringCGLIB$$c3af2d27.invoke(<generated>)
 org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
 org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
 io.micrometer.core.aop.CountedAspect.interceptAndRecord(CountedAspect.java:199)
 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 java.base/java.lang.reflect.Method.invoke(Method.java:568)
 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
 org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
 org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
 org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
 org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
 org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
 org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
 com.ioterop.anchorage.devicemanagement.infrastructure.messaging.coap.KafkaCoapConsumer$$EnhancerBySpringCGLIB$$f7081bb1.receiveMessage(<generated>)
 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
 java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 java.base/java.lang.reflect.Method.invoke(Method.java:568)
 org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:169)
 org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:119)
 org.springframework.kafka.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:56)
 org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:347)
 org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:92)
 org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:53)
 org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:2629)\n\t... 11 common frames omitted\n"

Steps to reproduce

public class Test {
    @Autowired
    private RedissonClient redissonClient;

    @Override
    public String callScheduler() {
        RScheduledExecutorService executorService = this.redissonClient.getExecutorService("EXECUTOR");
        return executorService
            .schedule(new CallableTask(), 10, TimeUnit.SECONDS)
            .getTaskId();
    }
}

What did you expect to see?
A valid span without exception

What did you see instead?
Can't produce a span and the thread crashs.

What version are you using?
Opentelemetry autoinstrumentation: v1.13.1
Redisson: 3.17.1

Environment
Compiler: Openjdk 17
OS: Ubuntu 20.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant