You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/02/26 03:41:16 UTC
[GitHub] [apisix] spacewander opened a new pull request #3682: chore: add safe limit to avoid infinite loop caused by bug
spacewander opened a new pull request #3682:
URL: https://github.com/apache/apisix/pull/3682
Signed-off-by: spacewander <sp...@gmail.com>
### What this PR does / why we need it:
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
### Pre-submission checklist:
* [x] Did you explain what problem does this PR solve? Or what new features have been added?
* [ ] Have you added corresponding test cases?
* [ ] Have you modified the corresponding document?
* [ ] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #3682: chore: add safe limit to avoid infinite loop caused by bug
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3682:
URL: https://github.com/apache/apisix/pull/3682#discussion_r583416007
##########
File path: apisix/balancer/roundrobin.lua
##########
@@ -18,12 +18,19 @@
local roundrobin = require("resty.roundrobin")
local core = require("apisix.core")
local nkeys = core.table.nkeys
+local pairs = pairs
local _M = {}
function _M.new(up_nodes, upstream)
+ local safe_limit = 0
+ for _, weight in pairs(up_nodes) do
+ -- the weight can be zero
+ safe_limit = safe_limit + weight + 1
Review comment:
I don't understand, why is `weight` needed here?
Is it better than `safe_limit = safe_limit + 1` ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a change in pull request #3682: chore: add safe limit to avoid infinite loop caused by bug
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #3682:
URL: https://github.com/apache/apisix/pull/3682#discussion_r583429123
##########
File path: apisix/balancer/roundrobin.lua
##########
@@ -18,12 +18,19 @@
local roundrobin = require("resty.roundrobin")
local core = require("apisix.core")
local nkeys = core.table.nkeys
+local pairs = pairs
local _M = {}
function _M.new(up_nodes, upstream)
+ local safe_limit = 0
+ for _, weight in pairs(up_nodes) do
+ -- the weight can be zero
+ safe_limit = safe_limit + weight + 1
Review comment:
The number of possible retry won't be larger than `weight + 1`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] membphis merged pull request #3682: chore: add safe limit to avoid infinite loop caused by bug
Posted by GitBox <gi...@apache.org>.
membphis merged pull request #3682:
URL: https://github.com/apache/apisix/pull/3682
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] Firstsawyou commented on a change in pull request #3682: chore: add safe limit to avoid infinite loop caused by bug
Posted by GitBox <gi...@apache.org>.
Firstsawyou commented on a change in pull request #3682:
URL: https://github.com/apache/apisix/pull/3682#discussion_r583490823
##########
File path: apisix/balancer/roundrobin.lua
##########
@@ -18,12 +18,19 @@
local roundrobin = require("resty.roundrobin")
local core = require("apisix.core")
local nkeys = core.table.nkeys
+local pairs = pairs
local _M = {}
function _M.new(up_nodes, upstream)
+ local safe_limit = 0
+ for _, weight in pairs(up_nodes) do
+ -- the weight can be zero
+ safe_limit = safe_limit + weight + 1
Review comment:
Thanks, got it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org