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

redis connection problem #8666

Closed
DingDongDeng opened this issue Feb 18, 2022 · 6 comments
Closed

redis connection problem #8666

DingDongDeng opened this issue Feb 18, 2022 · 6 comments
Assignees
Labels
Milestone

Comments

@DingDongDeng
Copy link

DingDongDeng commented Feb 18, 2022

Hello
I have a redis connection problem while using pinpoint(2.3.2), so I'm asking you this question.

### error message (It happens when I use RedisTemplate)
java.lang.ClassCastException: 
class io.lettuce.core.StatefulRedisConnectionImpl cannot be cast to class io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl 
### build.gradle
//spring boot 2.5.3
implementation 'org.springframework.data:spring-data-redis'
### redis config ( I'm using aws elastic cache)
### https://docs.spring.io/spring-data/data-redis/docs/current/reference/html/#redis:write-to-master-read-from-replica
    @Bean
    public RedisConnectionFactory redisConnectionFactory() {
        LettuceClientConfiguration lettuceClientConfigurationBuilder = LettuceClientConfiguration.builder()
            .commandTimeout(Duration.ofMillis(TIMEOUT))
            .shutdownTimeout(Duration.ofMillis(TIMEOUT))
            .readFrom(ReadFrom.REPLICA_PREFERRED)
            .build();

        RedisStaticMasterReplicaConfiguration clusterConfiguration = new RedisStaticMasterReplicaConfiguration(MASTER_HOST, MASTER_PORT);
        clusterConfiguration.addNode(REPLICA_HOST, REPLICA_PORT);

        LettuceConnectionFactory lettuceConnectionFactory = new LettuceConnectionFactory(
            clusterConfiguration, lettuceClientConfigurationBuilder);
        lettuceConnectionFactory.setValidateConnection(false);

        return lettuceConnectionFactory;
    }

Is there anything I need to check?
This error occurs frequently. (not always)

@jaehong-kim
Copy link
Contributor

@DingDongDeng
Please give me the full log file.

Pinpoint log file path:
${pinpoint-install-path}/logs/${agentId}/pinpoint.log

@jaehong-kim jaehong-kim self-assigned this Feb 18, 2022
@ekdxhrl0096
Copy link

+1

@ekdxhrl0096
Copy link

I can see with log:

03-28 14:32:22.022 [ntainer#1-3-C-1] WARN  c.n.p.p.r.l.i.AttachEndPointInterceptor  -- Failed to AFTER process. class io.lettuce.core.StatefulRedisConnectionImpl cannot be cast to class io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl (io.lettuce.core.StatefulRedisConnectionImpl and io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @6e02721d)
java.lang.ClassCastException: class io.lettuce.core.StatefulRedisConnectionImpl cannot be cast to class io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl (io.lettuce.core.StatefulRedisConnectionImpl and io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @6e02721d)
        at com.navercorp.pinpoint.plugin.redis.lettuce.interceptor.AttachEndPointInterceptor.after(AttachEndPointInterceptor.java:65) ~[pinpoint-redis-lettuce-plugin-2.3.3.jar:2.3.3]
        at com.navercorp.pinpoint.bootstrap.interceptor.scope.ExceptionHandleScopedInterceptor.after(ExceptionHandleScopedInterceptor.java:69) ~[?:2.3.3]
        at io.lettuce.core.RedisClient.connectAsync(RedisClient.java:254) ~[lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveTopologyProvider.getNodeDescription(StaticMasterSlaveTopologyProvider.java:100) ~[lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveTopologyProvider.lambda$getNodesAsync$0(StaticMasterSlaveTopologyProvider.java:83) ~[lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:378) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:267) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:225) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.request(ScopePassingSpanSubscriber.java:76) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:363) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onSubscribe(ScopePassingSpanSubscriber.java:69) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:161) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:86) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.Mono.subscribe(Mono.java:4213) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.Mono.subscribeWith(Mono.java:4324) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.Mono.toFuture(Mono.java:4658) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveTopologyProvider.getNodesAsync(StaticMasterSlaveTopologyProvider.java:94) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.MasterSlaveTopologyRefresh.getNodes(MasterSlaveTopologyRefresh.java:73) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveConnector.connectAsync(StaticMasterSlaveConnector.java:66) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.MasterSlave.connectAsyncSentinelOrStaticSetup(MasterSlave.java:232) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.MasterSlave.connect(MasterSlave.java:181) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterreplica.MasterReplica.connect(MasterReplica.java:153) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.StaticMasterReplicaConnectionProvider.getConnection(StaticMasterReplicaConnectionProvider.java:80) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1440) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1228) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1211) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:975) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:360) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:134) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:97) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:84) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:215) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:236) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at com.woowahan.otgateway.analysis.preprocessing.domain.factor.data.OrderAggregateFactorRedisRepository.save(OrderAggregateFactorRedisRepository.java:39) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.domain.factor.data.OrderAggregateFactorRedisRepository$$FastClassBySpringCGLIB$$dfe5dc84.invoke(<generated>) [classes!/:?]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) [spring-tx-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at com.woowahan.otgateway.analysis.preprocessing.domain.factor.data.OrderAggregateFactorRedisRepository$$EnhancerBySpringCGLIB$$8056170.save(<generated>) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.aggregate.order.OrderCreatedAggregatePreprocessor.doProcess(OrderCreatedAggregatePreprocessor.java:24) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.aggregate.order.OrderCreatedAggregatePreprocessor.doProcess(OrderCreatedAggregatePreprocessor.java:9) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.aggregate.order.DecoratingOrderAggregatePreprocessor.doProcess(DecoratingOrderAggregatePreprocessor.java:20) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.OrderEventHandler.handle(OrderEventHandler.java:35) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.adapter.OrderEventListener.listen(OrderEventListener.java:35) [classes!/:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:171) [spring-messaging-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120) [spring-messaging-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.kafka.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:48) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:329) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:86) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:51) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter$$FastClassBySpringCGLIB$$cde8c01d.invoke(<generated>) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.cloud.sleuth.instrument.messaging.MessageListenerMethodInterceptor.invoke(TraceMessagingAutoConfiguration.java:394) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
       at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter$$EnhancerBySpringCGLIB$$e2b3eaf4.onMessage(<generated>) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:1979) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeOnMessage(KafkaMessageListenerContainer.java:1961) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeRecordListener(KafkaMessageListenerContainer.java:1898) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeWithRecords(KafkaMessageListenerContainer.java:1838) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:1735) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:1465) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:1128) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:1031) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
03-28 14:32:22.022 [ntainer#1-3-C-1] WARN  c.n.p.p.r.l.i.AttachEndPointInterceptor  -- Failed to AFTER process. class io.lettuce.core.StatefulRedisConnectionImpl cannot be cast to class io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl (io.lettuce.core.StatefulRedisConnectionImpl and io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @6e02721d)
java.lang.ClassCastException: class io.lettuce.core.StatefulRedisConnectionImpl cannot be cast to class io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl (io.lettuce.core.StatefulRedisConnectionImpl and io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @6e02721d)
        at com.navercorp.pinpoint.plugin.redis.lettuce.interceptor.AttachEndPointInterceptor.after(AttachEndPointInterceptor.java:65) ~[pinpoint-redis-lettuce-plugin-2.3.3.jar:2.3.3]
        at com.navercorp.pinpoint.bootstrap.interceptor.scope.ExceptionHandleScopedInterceptor.after(ExceptionHandleScopedInterceptor.java:69) ~[?:2.3.3]
        at io.lettuce.core.RedisClient.connectAsync(RedisClient.java:254) ~[lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveTopologyProvider.getNodeDescription(StaticMasterSlaveTopologyProvider.java:100) ~[lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveTopologyProvider.lambda$getNodesAsync$0(StaticMasterSlaveTopologyProvider.java:83) ~[lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:378) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:267) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:225) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.request(ScopePassingSpanSubscriber.java:76) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:363) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onSubscribe(ScopePassingSpanSubscriber.java:69) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:161) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:86) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.Mono.subscribe(Mono.java:4213) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.Mono.subscribeWith(Mono.java:4324) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at reactor.core.publisher.Mono.toFuture(Mono.java:4658) [reactor-core-3.3.10.RELEASE.jar!/:3.3.10.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveTopologyProvider.getNodesAsync(StaticMasterSlaveTopologyProvider.java:94) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.MasterSlaveTopologyRefresh.getNodes(MasterSlaveTopologyRefresh.java:73) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.StaticMasterSlaveConnector.connectAsync(StaticMasterSlaveConnector.java:66) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.MasterSlave.connectAsyncSentinelOrStaticSetup(MasterSlave.java:232) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterslave.MasterSlave.connect(MasterSlave.java:181) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at io.lettuce.core.masterreplica.MasterReplica.connect(MasterReplica.java:153) [lettuce-core-5.3.4.RELEASE.jar!/:5.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.StaticMasterReplicaConnectionProvider.getConnection(StaticMasterReplicaConnectionProvider.java:80) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1440) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1228) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1211) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:975) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:360) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:134) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:97) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:84) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:215) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:188) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:96) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at org.springframework.data.redis.core.DefaultValueOperations.set(DefaultValueOperations.java:236) [spring-data-redis-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
        at com.woowahan.otgateway.analysis.preprocessing.domain.factor.data.OrderAggregateFactorRedisRepository.save(OrderAggregateFactorRedisRepository.java:39) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.domain.factor.data.OrderAggregateFactorRedisRepository$$FastClassBySpringCGLIB$$dfe5dc84.invoke(<generated>) [classes!/:?]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) [spring-tx-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at com.woowahan.otgateway.analysis.preprocessing.domain.factor.data.OrderAggregateFactorRedisRepository$$EnhancerBySpringCGLIB$$8056170.save(<generated>) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.aggregate.order.OrderCreatedAggregatePreprocessor.doProcess(OrderCreatedAggregatePreprocessor.java:24) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.aggregate.order.OrderCreatedAggregatePreprocessor.doProcess(OrderCreatedAggregatePreprocessor.java:9) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.aggregate.order.DecoratingOrderAggregatePreprocessor.doProcess(DecoratingOrderAggregatePreprocessor.java:20) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.application.OrderEventHandler.handle(OrderEventHandler.java:35) [classes!/:?]
        at com.woowahan.otgateway.analysis.preprocessing.adapter.OrderEventListener.listen(OrderEventListener.java:35) [classes!/:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:171) [spring-messaging-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120) [spring-messaging-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.kafka.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:48) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:329) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:86) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter.onMessage(RecordMessagingMessageListenerAdapter.java:51) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter$$FastClassBySpringCGLIB$$cde8c01d.invoke(<generated>) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:771) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.cloud.sleuth.instrument.messaging.MessageListenerMethodInterceptor.invoke(TraceMessagingAutoConfiguration.java:394) [spring-cloud-sleuth-core-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:749) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:691) [spring-aop-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
        at org.springframework.kafka.listener.adapter.RecordMessagingMessageListenerAdapter$$EnhancerBySpringCGLIB$$e2b3eaf4.onMessage(<generated>) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:1979) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeOnMessage(KafkaMessageListenerContainer.java:1961) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeRecordListener(KafkaMessageListenerContainer.java:1898) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeWithRecords(KafkaMessageListenerContainer.java:1838) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:1735) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:1465) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:1128) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:1031) [spring-kafka-2.5.6.RELEASE.jar!/:2.5.6.RELEASE]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

Thank you for your hard work.

@youdozi
Copy link

youdozi commented Jun 29, 2022

++ 1
I also have the same issue.

  • spring boot 2.7.1
  • spring data redis 2.7.1
  • aws elasticache replication

I changed the settings below so that it can work.
This is only temporary.

pinpoint.config modify
as-is

# Lettuce client
profiler.redis.lettuce.enable=true

to-be

# Lettuce client
profiler.redis.lettuce.enable=false

@beer-one
Copy link

@jaehong-kim

I using pinpoint 2.5.0 and I'm experiencing same issue.

https://github.com/pinpoint-apm/pinpoint/blob/v2.5.0/plugins/redis-lettuce/src/main/java/com/navercorp/pinpoint/plugin/redis/lettuce/interceptor/AttachEndPointInterceptor.java#L64

I guess since StatefulRedisConnectionImpl is instance of CompletableFuture, if block is executed. and This error seems to be caused by force casting to StatefulRedisClusterConnectionImpl.

I think If the result is of StatefulRedisConnectionImpl type, adding code to cast to StatefulRedisConnectionImpl will solve the problem.

if (result instanceof CompletableFuture) {
    
    // add to cast StatefulRedisConnectionImpl
    if (result instanceof StatefulRedisConnectionImpl) {
        StatefulRedisConnectionImpl statefulRedisConnection = (StatefulRedisConnectionImpl) ((CompletableFuture) result).get();
        ((EndPointAccessor) statefulRedisConnection)._$PINPOINT$_setEndPoint(endPoint);
        return;
    }
    
    StatefulRedisClusterConnectionImpl statefulRedisClusterConnection = (StatefulRedisClusterConnectionImpl) ((CompletableFuture) result).get();
    ((EndPointAccessor) statefulRedisClusterConnection)._$PINPOINT$_setEndPoint(endPoint);
    return;
}

@emeroad emeroad added this to the 2.5.1 milestone Jan 13, 2023
@jaehong-kim
Copy link
Contributor

@YunSeoWon
Thank you. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants