Zuul 灰度报错Error choosing server for key null解决办法

2020年4月14日16:55:20 发表评论 6,362 ℃

最近项目接入了灰度,但是在灰度的时候,概率性就出现Error choosing server for key null报错,如下图:

Zuul 灰度报错Error choosing server for key null解决办法

一开始以为是哪里配置有问题,反复对ribbon配置进行调整测试以后,还是会有问题,用jmeter在测试环境不停的请求,然后反复切换灰度,1000个请求,一定会概率出现几个请求Error choosing server for key null,如下图:

Zuul 灰度报错Error choosing server for key null解决办法

Zuul 灰度报错Error choosing server for key null解决办法

经过几天的方案查找和测试,最后终于通过Google找到了spring-cloud在GitHub上面的issues,链接是https://github.com/spring-cloud/spring-cloud-netflix/issues/2752

问题和我现在的情况一样,主要原因就是版本bug,问题体现在Spring-cloud-netflix 1.4.x 使用的Ribbon 2.2.4;原文如下:

I am seeing this exact issue with Boot 1.5.10 and Edgware (RELEASE, SR1, SR2) too. I found this merged PR in Ribbon which seems to fix it.

It is a problem introduced fairly recently, in the 2.2.4 release of Ribbon, which is used by spring-cloud-netflix 1.4.x. There is no release > 2.2.4 yet, so downgrading to Dalston was the only viable option for me. Once the next release of Ribbon is out, this will be an easy fix.

而我们项目使用的SpringBoot 1.5.10 (SpringCloud Dalston.RELEASE),果断选了一个服务把版本升级到了SpringBoot 1.5.22 (SpringCloud Edgware.SR6)进行测试,经过jmeter反复请求测试,再也没有出现过Error choosing server for key null报错,然后在把其他服务依次升级,在测试环境进行了测试,再也没出现过这个问题。

【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: