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

The redis connection is down #3066

Closed
hogger0 opened this issue Dec 3, 2024 · 1 comment
Closed

The redis connection is down #3066

hogger0 opened this issue Dec 3, 2024 · 1 comment
Labels
status: invalid An issue that we don't feel is valid

Comments

@hogger0
Copy link

hogger0 commented Dec 3, 2024

My redis is stand-alone version: 7.0.4.
The springboot version is 3.2.8.
The spring gateway service is connected to redis. If there is no operation for a period of time, Every 15 minutes or so and redis will disconnect the link and the console will report an error of connection reset. How is this caused? Do you need to modify the configuration of redis or spring?
spring:
data:
redis:
host: 192.168.146.123
port: 6379
password: 123456
timeout: 5000ms

[INFO ] 2024-12-03 17:16:59.852 [reactor-http-nio-4] c.i.i.g.filter.ApiLoggingFilter [gateway,674ecc8bfd41e875b009c8b010334dc4,c134df54bcb77c70,TID: N/A] - ip:null api:/auth/oauth2/token,status:200,ts:207ms [INFO ] 2024-12-03 17:17:00.050 [reactor-http-nio-7] c.i.i.g.filter.ApiLoggingFilter [gateway,674ecc8befd6115a81236d5ce271d6b9,ad230bcd7654dae1,TID: N/A] - ip:null api:/admin/permission/getMenu,status:200,ts:60ms [INFO ] 2024-12-03 17:17:00.544 [reactor-http-nio-7] c.i.i.g.filter.ApiLoggingFilter [gateway,674ecc8cac7a92ed8cdf15aed9f35aea,a700aaadeebb4e03,TID: N/A] - ip:null api:/admin/role/query,status:200,ts:44ms [ERROR] 2024-12-03 17:33:27.498 [HeartBeat-Task-Scheduler-1] o.s.c.g.route.CachingRouteLocator [gateway,,,TID: N/A] - Refresh routes error !!! org.springframework.data.redis.RedisSystemException: Redis exception at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:72) Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Assembly trace from producer [reactor.core.publisher.FluxMergeSequential] : reactor.core.publisher.Flux.flatMapSequential(Flux.java:5763) org.springframework.cloud.gateway.route.CompositeRouteDefinitionLocator.getRouteDefinitions(CompositeRouteDefinitionLocator.java:52) Error has been observed at the following site(s): *__Flux.flatMapSequential ⇢ at org.springframework.cloud.gateway.route.CompositeRouteDefinitionLocator.getRouteDefinitions(CompositeRouteDefinitionLocator.java:52) |_ Flux.flatMap ⇢ at org.springframework.cloud.gateway.route.CompositeRouteDefinitionLocator.getRouteDefinitions(CompositeRouteDefinitionLocator.java:53) |_ Flux.map ⇢ at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.getRoutes(RouteDefinitionRouteLocator.java:110) |_ Flux.map ⇢ at org.springframework.cloud.gateway.route.RouteDefinitionRouteLocator.getRoutes(RouteDefinitionRouteLocator.java:122) *__Flux.flatMapSequential ⇢ at org.springframework.cloud.gateway.route.CompositeRouteLocator.getRoutes(CompositeRouteLocator.java:36) |_ Flux.sort ⇢ at org.springframework.cloud.gateway.route.CachingRouteLocator.fetch(CachingRouteLocator.java:63) |_ Flux.sort ⇢ at org.springframework.cloud.gateway.route.CachingRouteLocator.fetch(CachingRouteLocator.java:63) |_ Flux.sort ⇢ at org.springframework.cloud.gateway.route.CachingRouteLocator.fetch(CachingRouteLocator.java:63) |_ Flux.collect ⇢ at org.springframework.cloud.gateway.route.CachingRouteLocator.onApplicationEvent(CachingRouteLocator.java:97) Original Stack Trace: at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:72) at org.springframework.data.redis.connection.lettuce.LettuceExceptionConverter.convert(LettuceExceptionConverter.java:41) at org.springframework.data.redis.PassThroughExceptionTranslationStrategy.translate(PassThroughExceptionTranslationStrategy.java:40) at org.springframework.data.redis.FallbackExceptionTranslationStrategy.translate(FallbackExceptionTranslationStrategy.java:38) at org.springframework.data.redis.connection.lettuce.LettuceConnection.convertLettuceAccessException(LettuceConnection.java:308) at org.springframework.data.redis.connection.lettuce.LettuceConnection.await(LettuceConnection.java:1026) at org.springframework.data.redis.connection.lettuce.LettuceConnection.lambda$doInvoke$3(LettuceConnection.java:445) at org.springframework.data.redis.connection.lettuce.LettuceInvoker$Synchronizer.invoke(LettuceInvoker.java:665) at org.springframework.data.redis.connection.lettuce.LettuceInvoker.just(LettuceInvoker.java:94) at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.hVals(LettuceHashCommands.java:202) at org.springframework.data.redis.connection.DefaultedRedisConnection.hVals(DefaultedRedisConnection.java:1456) at org.springframework.data.redis.core.DefaultHashOperations.lambda$values$16(DefaultHashOperations.java:217) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:396) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:363) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:97) at org.springframework.data.redis.core.DefaultHashOperations.values(DefaultHashOperations.java:217) at com.iauto.icmp.gateway.handler.RedisRouteDefinition.getRouteDefinitions(RedisRouteDefinition.java:38) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onNext(FluxMergeSequential.java:208) at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335) at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onSubscribe(FluxMergeSequential.java:198) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83) at reactor.core.publisher.Flux.subscribe(Flux.java:8840) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onNext(FluxMergeSequential.java:237) at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335) at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onSubscribe(FluxMergeSequential.java:198) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83) at reactor.core.publisher.Mono.subscribe(Mono.java:4568) at reactor.core.publisher.Mono.subscribeWith(Mono.java:4634) at reactor.core.publisher.Mono.subscribe(Mono.java:4534) at reactor.core.publisher.Mono.subscribe(Mono.java:4470) at reactor.core.publisher.Mono.subscribe(Mono.java:4442) at org.springframework.cloud.gateway.route.CachingRouteLocator.onApplicationEvent(CachingRouteLocator.java:98) at org.springframework.cloud.gateway.route.CachingRouteLocator.onApplicationEvent(CachingRouteLocator.java:42) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:452) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:385) at org.springframework.cloud.gateway.route.RouteRefreshListener.reset(RouteRefreshListener.java:73) at org.springframework.cloud.gateway.route.RouteRefreshListener.resetIfNeeded(RouteRefreshListener.java:68) at org.springframework.cloud.gateway.route.RouteRefreshListener.onApplicationEvent(RouteRefreshListener.java:62) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:452) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:385) at com.alibaba.cloud.nacos.discovery.NacosDiscoveryHeartBeatPublisher.publishHeartBeat(NacosDiscoveryHeartBeatPublisher.java:104) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) at java.base/java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:358) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: io.lettuce.core.RedisException: java.net.SocketException: Connection reset at io.lettuce.core.internal.Exceptions.bubble(Exceptions.java:83) at io.lettuce.core.internal.Futures.awaitOrCancel(Futures.java:250) at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:74) at org.springframework.data.redis.connection.lettuce.LettuceConnection.await(LettuceConnection.java:1024) at org.springframework.data.redis.connection.lettuce.LettuceConnection.lambda$doInvoke$3(LettuceConnection.java:445) at org.springframework.data.redis.connection.lettuce.LettuceInvoker$Synchronizer.invoke(LettuceInvoker.java:665) at org.springframework.data.redis.connection.lettuce.LettuceInvoker.just(LettuceInvoker.java:94) at org.springframework.data.redis.connection.lettuce.LettuceHashCommands.hVals(LettuceHashCommands.java:202) at org.springframework.data.redis.connection.DefaultedRedisConnection.hVals(DefaultedRedisConnection.java:1456) at org.springframework.data.redis.core.DefaultHashOperations.lambda$values$16(DefaultHashOperations.java:217) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:396) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:363) at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:97) at org.springframework.data.redis.core.DefaultHashOperations.values(DefaultHashOperations.java:217) at com.iauto.icmp.gateway.handler.RedisRouteDefinition.getRouteDefinitions(RedisRouteDefinition.java:38) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onNext(FluxMergeSequential.java:208) at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539) at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335) at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294) at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.java:649) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onSubscribe(FluxMergeSequential.java:198) at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.java:633) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83) at reactor.core.publisher.Flux.subscribe(Flux.java:8840) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onNext(FluxMergeSequential.java:237) at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:539) at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:335) at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:294) at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.request(FluxOnAssembly.java:649) at reactor.core.publisher.FluxMergeSequential$MergeSequentialMain.onSubscribe(FluxMergeSequential.java:198) at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onSubscribe(FluxOnAssembly.java:633) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:201) at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:83) at reactor.core.publisher.Mono.subscribe(Mono.java:4568) at reactor.core.publisher.Mono.subscribeWith(Mono.java:4634) at reactor.core.publisher.Mono.subscribe(Mono.java:4534) at reactor.core.publisher.Mono.subscribe(Mono.java:4470) at reactor.core.publisher.Mono.subscribe(Mono.java:4442) at org.springframework.cloud.gateway.route.CachingRouteLocator.onApplicationEvent(CachingRouteLocator.java:98) at org.springframework.cloud.gateway.route.CachingRouteLocator.onApplicationEvent(CachingRouteLocator.java:42) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:452) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:385) at org.springframework.cloud.gateway.route.RouteRefreshListener.reset(RouteRefreshListener.java:73) at org.springframework.cloud.gateway.route.RouteRefreshListener.resetIfNeeded(RouteRefreshListener.java:68) at org.springframework.cloud.gateway.route.RouteRefreshListener.onApplicationEvent(RouteRefreshListener.java:62) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:452) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:385) at com.alibaba.cloud.nacos.discovery.NacosDiscoveryHeartBeatPublisher.publishHeartBeat(NacosDiscoveryHeartBeatPublisher.java:104) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) at java.base/java.util.concurrent.FutureTask.runAndReset$$$capture(FutureTask.java:358) at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java) at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.net.SocketException: Connection reset at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:401) at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:434) at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:255) at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:356) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ... 1 common frames omitted [INFO ] 2024-12-03 17:33:27.588 [lettuce-eventExecutorLoop-3-1] i.l.core.protocol.ConnectionWatchdog [gateway,,,TID: N/A] - Reconnecting, last destination was /192.168.146.123:6379 [INFO ] 2024-12-03 17:33:27.609 [lettuce-nioEventLoop-5-3] i.l.c.protocol.ReconnectionHandler [gateway,,,TID: N/A] - Reconnected to 192.168.146.123/<unresolved>:6379

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 3, 2024
@mp911de
Copy link
Member

mp911de commented Dec 3, 2024

Looks like some component between your application and Redis is disconnecting your connection. Sounds like an infrastructure issue.

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2024
@mp911de mp911de added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants