AdguardTeam / dnsproxy

Simple DNS proxy with DoH, DoT, DoQ and DNSCrypt support
Apache License 2.0
2.44k stars 247 forks source link

failed to sufficiently increase receive buffer size #204

Closed liang-hiwin closed 2 years ago

liang-hiwin commented 2 years ago
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Creating the UDP server socket
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Listening to udp://[::]:5312
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Creating a TCP server socket
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Listening to tcp://[::]:5312
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Creating a QUIC listener
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Listening to quic://[::]:8053
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Entering the UDP listener loop on [::]:5312
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Entering the tcp listener loop on [::]:5312
Feb 11 22:12:13 dot  dnsproxy[11184]: 2022/02/11 22:12:13 [info] Entering the DNS-over-QUIC listener loop on [::]:8053
ameshkov commented 2 years ago

Not a bug. The issue is explained here: https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size

guillaume-uH57J9 commented 1 year ago

Hi !

While large buffer size is better for high-bandwidth server, measurements show larger buffers are worse (ie more packet loss) for servers with low-to-average bandwidth. See Higher rmem_max value leading to more packet loss

dnsproxy exposes option "--udp-buf-size=", so I tried using this parameter to use my system default:

./dnsproxy --udp-buf-size=0 -u ...

./dnsproxy --udp-buf-size=212992 ...

Unfortunately the warning persist regarless of parameter udp-buf-size:

dnsproxy[1180629]: 2022/12/03 13:07:08 failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.

This is confusing, I don't know if the parameter is being ignored, or if there's something else going on. To investigate I added logging to proxy/server_udp.go to verify my buffer size is passed to the UDP Listener. It shows the requested value is use when calling udpListen.SetReadBuffer(...) so I'm wondering why there's still this warning.

Aside from the warning, dnsproxy is working nicely. Thanks to developers on the DoQ implementation !

iJorgen commented 1 year ago

I don't know if the parameter is being ignored, or if there's something else going on.

I recall this from another issue mentioning it's not used... https://github.com/AdguardTeam/dnsproxy/issues/277

ameshkov commented 1 year ago

Check the link: https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size

dnsproxy's udp-buf-size is not linked to that warning.