微服务请求报错问题:
reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response Suppressed: The stacktrace has been enhanced by Reactor, refer to additional information below: Error has been observed at the following site(s): *__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain] *__checkpoint ⇢ com.crunii.core.web.auth.filter.ReactiveUserAuthenticationFilter [DefaultWebFilterChain] Original Stack Trace:
解决办法:调整超时时间
增加微服务的配置
spring:
cloud:
gateway:
httpclient:
pool:
maxIdleTime: 10
maxLifeTime: 10
maxIdleTime:这个参数通常用于数据库连接池或缓存系统中,表示连接或缓存项在空闲状态下的最大存活时间。当一个连接或缓存项在这个时间内没有被使用时,它会被释放回池中,以便其他请求可以使用。这样可以有效地管理资源,避免长时间占用而浪费资源。
maxLifeTime:这个参数也常用于数据库连接池或缓存系统中,表示连接或缓存项的最长生命周期。当一个连接或缓存项达到这个时间限制时,它会被强制关闭并从池中移除,即使它还处于空闲状态。这可以确保长时间未使用的连接或缓存项不会占用过多资源,同时也可以防止潜在的内存泄漏问题。
精彩链接
发表评论