问题描述

zuul1.x使用过程中,偶尔会出现failed to respond的异常信息,对应的异常为httpclient 的 NoHttpResponseException。

解决方案

zuul作为client方连接nginx代理的服务,对应的设置为:

zuul.host.max-per-route-connections=600
zuul.host.socket-timeout-millis=10000
zuul.host.connect-timeout-millis=10000
zuul.host.time-to-live=600000

而nginx设置的keepalive_timeout=180s,所以当空闲达到180s时,服务端已经断开了连接。这时候httpclient在拿到pool里的connection时就有可能出现NoHttpResponseException。

应该将zuul.host.time-to-live设置为 <= nginx的keepalive_timeout。
另外zuul.host.max-per-route-connections应该根据实际情况分配,不宜过大。

但是经过测试,只是偶尔会出现,httpclient内部也在使用各种机制保证connection在断开之后能继续重连。

Most likely persistent connections that are kept alive by the connection manager become stale. That is, the target server shuts down the connection on its end without HttpClient being able to react to that event, while the connection is being idle, thus rendering the connection half-closed or 'stale'. Usually this is not a problem. HttpClient employs several techniques to verify connection validity upon its lease from the pool. Even if the stale connection check is disabled and a stale connection is used to transmit a request message the request execution usually fails in the write operation with SocketException and gets automatically retried. However under some circumstances the write operation can terminate without an exception and the subsequent read operation returns -1 (end of stream). In this case HttpClient has no other choice but to assume the request succeeded but the server failed to respond most likely due to an unexpected error on the server side. The simplest way to remedy the situation is to evict expired connections and connections that have been idle longer than, say, 1 minute from the pool after a period of inactivity.

failed to respond问题查找相关推荐

  1. 【异常(待解决)】org.apache.http.NoHttpResponseException: api.weixin.qq.com:443 failed to respond

    [异常(待解决)]org.apache.http.NoHttpResponseException: api.weixin.qq.com:443 failed to respond 参考文章: (1)[ ...

  2. 微信 开发诡异的40029错误invalid code错误 443 failed to respond错误的解决办法

    情景:使用静默授权或感知授权的方式将请求绑定到微信公众号的菜单栏上.链接如下: https://open.weixin.qq.com/connect/oauth2/authorize?appid=AP ...

  3. HttpClient 出现 failed to respond 异常解决

    今天碰到一个问题,httpclient 在使用线程池时,偶尔出现 NoHttpResponseException 异常. httpclient org.apache.http.NoHttpRespon ...

  4. Apache Flink写入Clickhouse报错 code: 1002, ip:8123 failed to respond

    目录 版本 一.问题 1 问题描述 2 日志 二.解决 解决过程 1 升级驱动jar包版本(无效) 2 修改连接参数(无效) 3 修改服务端参数(有效) 4 修改获取连接方式(todo) 参考资料 版 ...

  5. 使用httpclient时报错NoHttpResponseException failed to respond

    异常信息 org.apache.http.NoHttpResponseException xxx failed to respond at org.apache.http.impl.conn.Defa ...

  6. http请求报错:80 failed to respond

    A系统设置的接口为短连接 B系统设置的接口为长连接 B系统同一个接口调多次A系统的接口的时候,第一次请求完成之后,A系统会断开连接,而B系统不会断开连接,再次访问A系统的时候还是会用上一次请求的端口继 ...

  7. go get 下载包时提示 nnection failed because connected host has failed to respond 解决方法.

    go get 下载包时提示 nnection failed because connected host has failed to respond 解决方法. 第一步: 打开 cmd 输入命令配置国 ...

  8. Android Studio设置代理后显示:Cause: dl.google.com:443 failed to respond错误

    以前在Android Studio 的Preference设置中,设置了socks代理后,就能够正常的进行更新和自动下载依赖,最近老是有问题,今天在添加了新的依赖后,点编译按钮就显示 Cause: d ...

  9. Feign-feign.RetryableException: 192.168.100.26:8100 failed to respond executing GET URL

    报错内容 15:01:08.709 ERROR 10563 --- [nio-8000-exec-4] c.y.c.w.e.GlobalExceptionHandler : 未知异常,异常原因:192 ...

最新文章

  1. 产品经理岗位职责说明_技术负责人岗位职责,五大方面,超越岗位抓住未来才是技术大牛...
  2. fnv64 mysql,centos7安装搭建rabbitmq
  3. 判断三角形与射线相交的完整代码。。。
  4. 建高性能ASP.NET站点 第五章—性能调优综述(中篇)
  5. 《C++面向对象高效编程(第2版)》——3.4 赋值操作符
  6. SwiftUI之深入解析高级动画的时间轴TimelineView
  7. android 删除wifi文件在哪里设置,如何删除无线终端的无线配置文件
  8. 服务器系统自带ftp,win10如何使用自带FTP服务器
  9. python工资一般多少p-Python是什么?简单了解pythonp-入门
  10. 三星note10 android q,【极光ROM】-【三星NOTE10/NOTE10+/5G N97XX-9825】-【V4.0 Android-Q-TD1】...
  11. php b2c源码,Thinkphp5萤火商城B2C小程序源码
  12. 北航计算机学院国家奖学金,2019年经管学院研究生国家奖学金预审结果公示
  13. mysql数据库myd文件丢失怎么_mysql数据库的恢复(frm、Myd、MyI文件仍存在)
  14. 枢纽披红彩车上路 申城公交传递城市年味
  15. python读取压缩文件的大小_python查看zip包中文件及大小的方法
  16. 新增轮播图跳转web页面、轮播、推荐歌单数据存储( 简易音乐 七)
  17. 记一次内网SSH后门误报事件
  18. 中层管理者八大绝招 —— 如何培养基层管理者?
  19. Docker pull 失败,更换国内源daocloud
  20. linux:通过rpm包部署FTP服务

热门文章

  1. 规则引擎在数据治理平台的实践
  2. ListView控件的理解——自洽理论
  3. 未转变者DLC皮肤在服务器,未转变者 steam上 最新的版本 肿么联机?肿么创建房间...
  4. 爱奇艺奇秀直播的秒播体验优化实践
  5. 使用CloudCompare渲染好看的油麦菜点云的小方法
  6. caffe+cuda6.5+cudnn7.0+opencv3.0搭建经验记录
  7. 入局二手奢侈品赛道,考拉海购想象力几何?
  8. python egg_python egg 简介
  9. thinkphp5.1使用云之讯
  10. php开放平台,顺丰开放平台API PHP SDK demo