This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
     new f8f9930  Fix strict round robin cur_index increment
f8f9930 is described below

commit f8f9930c4ea1b85ddf0409e614bb55b84051df46
Author: Valentin Gutierrez <[email protected]>
AuthorDate: Wed Jan 15 10:36:53 2020 +0000

    Fix strict round robin cur_index increment
    
    rr_next was wrongly casted as a int32_t instead of as uint32_t. As shown
    on trafficserver#6321, on long-lived ATS instances the value of rr_next
    would be interpreted as a negative value, it would be incremented till
    the value reaches 0, hence all the traffic hits the first parent
    
    (cherry picked from commit 47e9d3090de5430b23f6343675496ccddaab90dd)
    
     Conflicts:
        proxy/ParentRoundRobin.cc
---
 proxy/ParentRoundRobin.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxy/ParentRoundRobin.cc b/proxy/ParentRoundRobin.cc
index 5cd45ca..194423b 100644
--- a/proxy/ParentRoundRobin.cc
+++ b/proxy/ParentRoundRobin.cc
@@ -99,8 +99,8 @@ ParentRoundRobin::selectParent(bool first_call, ParentResult 
*result, RequestDat
         }
         break;
       case P_STRICT_ROUND_ROBIN:
-        cur_index = ink_atomic_increment((int32_t *)&result->rec->rr_next, 1);
-        cur_index = result->start_parent = cur_index % num_parents;
+        cur_index = result->start_parent =
+          ink_atomic_increment(reinterpret_cast<uint32_t 
*>(&result->rec->rr_next), 1) % num_parents;
         break;
       case P_NO_ROUND_ROBIN:
         cur_index = result->start_parent = 0;

Reply via email to