阿汤博客-承接中小企业服务器维护和网站维护,有意者可以联系博主!

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

运维问题 858℃ 0评论

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

Error choosing server for key null

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

Error choosing server for key null

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报错,然后在把其他服务依次升级,在测试环境进行了测试,再也没出现过这个问题。

转载请注明:阿汤博客 » Zuul 灰度报错Error choosing server for key null解决办法

喜欢 (0)or分享 (0)