apisix icon indicating copy to clipboard operation
apisix copied to clipboard

bug: In proxy UDP, roundrobin is unbalanced

Open zhuchengxing opened this issue 6 years ago • 11 comments

Issue description

When I used UDP proxy, I find roundrobin unbalanced. Once the connection is established, it will always send a message to only one of the nodes!

Environment

  • apisix version (cmd: apisix version): 2.0
  • OS:centos7

Minimal test code / Steps to reproduce the issue

  1. config stream_routes: { "server_addr": "10.3.174.125",
    "server_port": 9200,
    "upstream": { "nodes": { "10.3.174.127:29090": 1, "10.3.174.126:29090": 1 }, "type": "roundrobin" } }

  2. test send message,I sent several pieces of data to ApisiX 9200 port with the nc command,commplete command: nc -p 6336 -u 10.3.174.125 9200 q

3.Apisix would forward the UDP message sent, but it was forwarded to only one node without load balancing effect, which made me very confused: 2 3

What's the actual result? (including assertion message & call stack if applicable)

You can see that the message is only forwarded to node 126!

What's the expected result?

I expect to achieve responsible and balanced results.

zhuchengxing avatar Nov 20 '20 02:11 zhuchengxing

Hi, @zhuchengxing, have you check the error log?

And you can try to send UDP package to node 127 directly. Like this

nc -p 6336 -u 10.3.174.127 290290

Is that ok?

starsz avatar Nov 22 '20 15:11 starsz

@zhuchengxing any update? my environment ( master branch ) is reproduce the problem according to your steps

idbeta avatar Nov 23 '20 05:11 idbeta

Hi, @zhuchengxing, have you check the error log?

And you can try to send UDP package to node 127 directly. Like this

nc -p 6336 -u 10.3.174.127 290290

Is that ok?

yes ! nc -p 6336 -u 10.3.174.127 29090

zhuchengxing avatar Nov 23 '20 06:11 zhuchengxing

@zhuchengxing any update? my environment ( master branch ) cannot reproduce the problem according to your steps,

!!!!! I just tried it again, but it still doesn't load balance, is that because the master branch has changed? i used 2.0

zhuchengxing avatar Nov 23 '20 06:11 zhuchengxing

@zhuchengxing I reproduce your problem now, i am not familiar with this feature, cc @membphis

idbeta avatar Nov 23 '20 06:11 idbeta

@idbeta ok, thanks .

zhuchengxing avatar Nov 23 '20 06:11 zhuchengxing

welcome to submit PR to fix this issue

membphis avatar Nov 23 '20 14:11 membphis

Can't reproduce on master

yujqiao avatar Oct 28 '21 08:10 yujqiao

@shuaijinchao Could you reproduce it?

spacewander avatar Oct 28 '21 11:10 spacewander

I can’t reproduce this problem using nc and client in a local debug environment


image

shuaijinchao avatar Nov 02 '21 03:11 shuaijinchao

Consider solved. Feel free to reopen it if need.

spacewander avatar Nov 02 '21 05:11 spacewander