Firstsawyou commented on issue #4090:
URL: https://github.com/apache/apisix/issues/4090#issuecomment-823848763


   > I modify some input args at Line 281 of traffic-spllit.lua and try it in 
version 2.0 and there exist a bug. When I first send a request with "id = 1", 
it correctly chooses upstream_A. But after that, no matter what I send with "id 
= 1" or "id = 2", it always chooses upstream_A and never chooses upstream_B.
   > 
   > Then I reload APISIX, this time I first send a request with "id = 2", it 
correctly chooses upstream_B. Then if I request with "id = 1" or "id = 2", it 
always chooses upstream_B.
   > 
   > It seems that the problem is at Line 281 and Line 288 of traffic-split.lua
   > 
   > > local rr_up, err = core.lrucache.plugin_ctx(plugin_name, ctx, 
new_rr_obj, weighted_upstreams)
   > > local upstream = rr_up:find()
   > 
   > I print the log to see `weighted_upstreams` before Line 281 and it is 
correct. But Line 288 does not give the right output.
   
   Yes, this is a known bug. If you want to implement this function in APISIX 
2.5, you can refer to the following PR to modify the traffic-split.lua code.
   
https://github.com/apache/apisix/pull/4092/files#diff-95a2018f002f15f5fb0714075b5ef27a1db113c186bfe20ae705f6023080b38fL280-L283


-- 
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:
[email protected]


Reply via email to