daeuniverse / dae

eBPF-based Linux high-performance transparent proxy solution.
GNU Affero General Public License v3.0
2.62k stars 165 forks source link

fix: incidental packet drop and weird UDP state maintaining #539

Closed mzz2017 closed 1 week ago

mzz2017 commented 2 weeks ago

Background

ebpf drop

The past two PRs #493, #505 have introduced a weird problem: erroneous UDP status maintenance will occur when a large number of concurrent messages are sent.

This results in some packets of stateful udp connection being incorrectly sent directly (such as what should be proxied and sent to dae control plane), resulting in sporadic packet drop. May be relevant: https://github.com/daeuniverse/dae/pull/533#issuecomment-2163408055.

This problem is particularly likely to be triggered when the original traffic is udp and the throughput is large, such as http3 traffic and bt traffic.

Although I haven't fully verified, this fix may incidentally resolve the DNS leak issue.

unordered udp packets

The data which should be in order will be handled as unordered by dae, which may cause more resources by quic to process.

Checklist

Full Changelogs

Issue Reference

Closes #513

Test Result

NA

dae-prow[bot] commented 2 weeks ago

❌ Your branch is currently out-of-sync to main. No worry, I will fix it for you.

mnixry commented 2 weeks ago

Thank you! The fix has been confirmed to work effectively in my local tests. HTTP/3 connections are now able to maintain a reasonable speed.

In real-world scenarios, HTTP/3 now enables smooth playback of 4K videos at 60fps on YouTube without buffering, a feat that was nearly impossible before.

mnixry commented 2 weeks ago

Further testing has shown that HTTP/3 upload speeds still drop to zero after a short time. The following command can be used to establish a benchmark for this issue:

./curl -X POST --form file=@/tmp/test.bin -Lv --http3-only "https://h3.speed.cloudflare.com/__up" > /dev/null

image

The results from https://h3.speed.cloudflare.com/ also indicate there is a problem:

image

jschwinger233 commented 2 weeks ago

Maybe also fix https://github.com/daeuniverse/dae/issues/513? Orz

mzz2017 commented 2 weeks ago

Further testing has shown that HTTP/3 upload speeds still drop to zero after a short time.

@mnixry Thanks for your rapid feedback. I have reproduced this problem.

mzz2017 commented 2 weeks ago

I observed an interesting phenomenon. Like yours, the data sending was stuck after sending 1023K.

mzz2017 commented 2 weeks ago

@mnixry It seems that the data should be in-order and dae handle all packets as unordered. I'll fix it soon.

mzz2017 commented 2 weeks ago

@mnixry I've pushed a commit https://github.com/daeuniverse/dae/pull/539/commits/a0a1aced6ea3b583b304b7ae5b55ddd445e3332c that may fix the problem. Could you please take a try?