springcloud config坑系列一之Connection pool shut down on "zuul.host.*" property change
在使用springcloud config自动刷新功能难免会踩到一些坑,下面来介绍下
在生成中经常需要动态刷新配置,只需要增加@RefreshScope,并且执行手动刷新链接/actuator/refresh,或者集成springcloudbus来自动刷新,但是有些配置动态刷新时需要实例化一些spring内部复杂的对象,这里就不能自动更新了,比如说zuul。
zuul路由配置可以自动刷新,
zuul:
sensitive-headers:
routes:
api-b:
path: /apib/**
serviceId: dataeyeServer
但是设计到zuul内部resttemplate的一些超时配置,如果改动了,并且手动刷新,则会出现标题中的错误Connection pool shut down on "zuul.host.*" property change
zuul:
host:
connect-timeout-millis: 10000
socket-timeout-millis: 600000
错误信息如下:
java.lang.IllegalStateException: Connection pool shut down
at org.apache.http.util.Asserts.check(Asserts.java:34) ~[httpcore-4.4.8.jar:4.4.8]
at org.apache.http.pool.AbstractConnPool.lease(AbstractConnPool.java:191) ~[httpcore-4.4.8.jar:4.4.8]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.requestConnection(PoolingHttpClientConnectionManager.java:257) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:176) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.3.jar:4.5.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) ~[httpclient-4.5.3.jar:4.5.3]
at org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal(HttpComponentsClientHttpRequest.java:89) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:659) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:628) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:302) ~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
这是由于自动刷新时,由于host中超时时间配置变更导致连接池先关闭,再准备重新创建,但是在重现创建的过程中却没有重新创建连接池,还是引用原有连接池导致报错。
解决方案一:将springcloud升级到Edgware.RELEASE,即
spring-cloud-commons-dependencies 版本升级到1.3.2.RELEASE
解决方案二:手动实例化连接池
参考资料
https://github.com/spring-cloud/spring-cloud-netflix/issues/3406
https://github.com/spring-cloud/spring-cloud-commons/issues/330
https://github.com/spring-cloud/spring-cloud-config/issues/918
springcloud config坑系列一之Connection pool shut down on "zuul.host.*" property change的更多相关文章
- java.lang.IllegalStateException: Connection pool shut down
最近使用HttpClient 4.5 使用 CloseableHttpClient 发起连接后,使用CloseableHttpResponse 接受返回结果,结果就报错了,上网查了下,有位stacko ...
- com.aliyun.oss.ClientException: Connection error due to: Connection pool shut down
com.aliyun.oss.ClientException: Connection error due to: Connection pool shut down[ErrorCode]: Unkno ...
- Can not find connection pool config file
暂时未解决 checkActivation=====================true Can Not Parse ConnectionCfg! 2019/10/12-11:23:38 > ...
- SpringCloud 源码系列(5)—— 负载均衡 Ribbon(下)
SpringCloud 源码系列(4)-- 负载均衡 Ribbon(上) SpringCloud 源码系列(5)-- 负载均衡 Ribbon(下) 五.Ribbon 核心接口 前面已经了解到 Ribb ...
- SpringCloud 源码系列(6)—— 声明式服务调用 Feign
SpringCloud 源码系列(1)-- 注册中心 Eureka(上) SpringCloud 源码系列(2)-- 注册中心 Eureka(中) SpringCloud 源码系列(3)-- 注册中心 ...
- springcloud情操陶冶-springcloud config server(三)
承接前文springcloud情操陶冶-springcloud config server(二),本文就不讲述server了,就简单阐述下client的应用 前话 config server在引入的时 ...
- SpringCloud 进阶之分布式配置中心(SpringCloud Config)
1. SpringCloud Config SpringCLoud Config 为微服务架构中的微服务提供集中化的外部配置支持,配置服务器为各个不同微服务应用 的所有环境提供了一个中心化的外部配置; ...
- 【爬坑系列】之kubernetes环境搭建:二进制安装与镜像安装
准备: 网上教如何编译与安装kubernetes的教程很多,需要提前准备的也很多,比如关闭selinux,防火墙啦....但有一点一定要注意,编译kubernetes源码时要求有2G内存,这个可是实打 ...
- springcloud Config 入门,带视频
疯狂创客圈 Java 高并发[ 亿级流量聊天室实战]实战系列 [博客园总入口 ] 架构师成长+面试必备之 高并发基础书籍 [Netty Zookeeper Redis 高并发实战 ] 前言 Crazy ...
- SpringCloud学习笔记(九):SpringCloud Config 分布式配置中心
概述 分布式系统面临的-配置问题 微服务意味着要将单体应用中的业务拆分成一个个子服务,每个服务的粒度相对较小,因此系统中会出现大量的服务.由于每个服务都需要必要的配置信息才能运行,所以一套集中式的.动 ...
随机推荐
- 没有 Git,如何下载 Gitee 代码?
目录 没有 Git,如何下载 Gitee 代码? 注册 Gitee 账号 下载代码压缩包 没有 Git,如何下载 Gitee 代码? 鉴于看我博客的人很多都是大学本科生.非 CS 专业,大部分人都不会 ...
- CLR via C# 笔记 -- 特性(18)
1. 特性继承自System.Attribute,能作用于TypeDef(类.结构.枚举.接口和委托),MethodDef(含构造器),ParamDef,FieldDef,PropertyDef,Ev ...
- 基于Python和TensorFlow实现BERT模型应用
本文分享自华为云社区<使用Python实现深度学习模型:BERT模型教程>,作者: Echo_Wish. BERT(Bidirectional Encoder Representation ...
- ClickHouse介绍(四)ClickHouse使用操作
ClickHouse使用操作 这章主要介绍在ClickHouse使用的各个操作的注意点.常规的统一语法不做详细介绍. 1. Join操作 在ClickHouse中,对连接操作定义了不同的精度,包含AL ...
- Linux 内核:设备驱动模型(3)class与device
Linux 内核:设备驱动模型(3)class与device 背景 前面我们知道了设备如何通过总线与驱动匹配,也了解了设备插拔时与用户空间是如何通过uevent基于环境变量进行交互的. 前面看过了设备 ...
- FFmpeg新旧接口对照使用一览
背景 根据例程学习调用ffmpeg 库方法的时候,发现了一堆警告. main.cpp:81:37: warning: 'AVStream::codec' is deprecated [-Wdeprec ...
- Java模拟高并发测试
线程类,设置有一个公共资源 package cn.org.chris.concurrent; import java.util.concurrent.locks.Lock; import java.u ...
- 3562-Qt工程编译说明
- [UG 二次开发 python] 导出BOM表(包含图片)
只导出最底层的零件,零件的属性已经设置好,零件的截图生成后,放在零件的同一个文件夹下 用到了 xlsxwriter # nx: threaded # 导出BOM表 __version__ = &quo ...
- 基于 .net core 8.0 的 swagger 文档优化分享-根据命名空间分组显示
前言 公司项目是是微服务项目,网关是手撸的一个.net core webapi 项目,使用 refit 封装了 20+ 服务 SDK,在网关中进行统一调用和聚合等处理,以及给前端提供 swagger ...