Zuul 灰度報錯Error choosing server for key null解決辦法

2020年4月14日16:55:20 發(fā)表評論 8,030 ℃

最近項目接入了灰度,但是在灰度的時候,概率性就出現(xiàn)Error choosing server for key null報錯,如下圖:

Zuul 灰度報錯Error choosing server for key null解決辦法

一開始以為是哪里配置有問題,反復(fù)對ribbon配置進行調(diào)整測試以后,還是會有問題,用jmeter在測試環(huán)境不停的請求,然后反復(fù)切換灰度,1000個請求,一定會概率出現(xiàn)幾個請求Error choosing server for key null,如下圖:

Zuul 灰度報錯Error choosing server for key null解決辦法

Zuul 灰度報錯Error choosing server for key null解決辦法

經(jīng)過幾天的方案查找和測試,最后終于通過Google找到了spring-cloud在GitHub上面的issues,鏈接是https://github.com/spring-cloud/spring-cloud-netflix/issues/2752

問題和我現(xiàn)在的情況一樣,主要原因就是版本bug,問題體現(xiàn)在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),果斷選了一個服務(wù)把版本升級到了SpringBoot 1.5.22 (SpringCloud Edgware.SR6)進行測試,經(jīng)過jmeter反復(fù)請求測試,再也沒有出現(xiàn)過Error choosing server for key null報錯,然后在把其他服務(wù)依次升級,在測試環(huán)境進行了測試,再也沒出現(xiàn)過這個問題。

【騰訊云】云服務(wù)器、云數(shù)據(jù)庫、COS、CDN、短信等云產(chǎn)品特惠熱賣中

發(fā)表評論

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