AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
25.5k stars 1.83k forks source link

anyone encounter this problem? upstream dns response so long time. #6901

Open andylau004 opened 7 months ago

andylau004 commented 7 months ago

Prerequisites

Platform (OS and CPU architecture)

Linux, AMD64 (aka x86_64)

Installation

GitHub releases or script from README

Setup

On one machine

AdGuard Home version

master

Action

  1. The elapsed time will occur whenever bootstrap: dialing and bootstrap: connection to occurs twice, elapsed more than 10 seconds, which is the dnsproxy query upstream dns server: 94.140.14.140:53.

  2. I don't know why, has anyone else encountered this situation, thank you for your reply

WechatIMG106

  1. my config web image

image

image

Expected result

expect upstream dns server response very quick.

just like this: elapsed 300.037022ms

Actual result

WechatIMG106

Additional information and/or screenshots

no other info.

andylau004 commented 7 months ago
  1. when AdGuardHome recv doh dns request, and no cache <url, ip> , then will call processUpstream ---> if err := prx.Resolve(pctx); err != nil ----> exchangeUpstream
in function exchangeUpstream

    if len(ups) == 1 {  // only one dns upstream server
        u = ups[0]
        resp, _, err = exchange(u, req, p.time)
        // TODO(e.burkov):  p.updateRTT(u.Address(), elapsed)

        return resp, u, err
    }
  1. then call exchange
    resp, _, err = exchange(u, req, p.time)

in exchange function ,then call

reply, err := u.Exchange(req)
  1. in Exchange function will call
    
    func (p *plainDNS) Exchange(req *dns.Msg) (resp *dns.Msg, err error)

... resp, err = p.dialExchange(p.net, dial, req) ...

then call function,,, dial bootstrap.DialHandler,

    for i, addr := range addrs {
        log.Debug("bootstrap: dialing %s (%d/%d) nw: %+v", addr, i+1, l, network)

        start := time.Now()
        conn, err = dialer.DialContext(ctx, network, addr)
        elapsed := time.Since(start)
        if err != nil {
            log.Debug("bootstrap: connection to %s failed in %s: %s", addr, elapsed, err)
            errs = append(errs, err)

            continue
        }

        log.Debug("bootstrap: connection to %s succeeded in %s", addr, elapsed)

        return conn, nil
    }


5.  so,,why `bootstrap: dialing`  and `bootstrap: connection to`  occurs twice

?????

i have no idea...

and  when occurs twice ,,then  upstream dns server  response time, elapsed  so long seconds,(always >=10 secs)
selevn-1 commented 7 months ago

i have same problem i using android phone with magsik adguardhome module that connected to my openwrt router and am updating every time adguardhome and works but since 107.47 and 107.48 didn't work adguardhome there is lag and i get no internet and limited connection so i try beta v0.108.0-b.54 with same settings and it works fine

marcelloinfoweb commented 7 months ago

Same problem in v0.107.48

andylau004 commented 7 months ago

i have same problem i using android phone with magsik adguardhome module that connected to my openwrt router and am updating every time adguardhome and works but since 107.47 and 107.48 didn't work adguardhome there is lag and i get no internet and limited connection so i try beta v0.108.0-b.54 with same settings and it works fine我有同样的问题 我使用带有 Magsik AdGuardHome 模块的 Android 手机连接到我的 OpenWRT 路由器,并且每次 AdguardHome 都更新并正常工作,但由于 107.47 和 107.48 不起作用,adguardhome 有延迟,我没有互联网和连接有限,所以我尝试使用相同的设置测试版 v0.108.0-b.54,它工作正常


Ok, I'm going to download this branch and give it a try, thks for your reply

andylau004 commented 7 months ago

i have same problem i using android phone with magsik adguardhome module that connected to my openwrt router and am updating every time adguardhome and works but since 107.47 and 107.48 didn't work adguardhome there is lag and i get no internet and limited connection so i try beta v0.108.0-b.54 with same settings and it works fine


threre are embarrassed! v0.108.0-b.54 have same problem also..

but i change AdGuardHome.yaml config (response time more faster,, less cost)

new configuration items below ,,,,

ratelimit: 0
cache_size: 16777220
  upstream_dns:
    - 94.140.14.140:53
    - 223.5.5.5:53
upstream_timeout: 2s
max_goroutines: 500
upstream_mode: load_balance

may be upstream_mode: parallel will more useful,,,

@marcelloinfoweb @selevn-1 @geraistec @al-skobelev

renatoyamane commented 7 months ago

I'm noticing a much higher response time on v0.107.48 than before, mainly on DNSCrypt servers, which usually was less than 70ms.

But now: resp_time

Servers:

sdns://AQAAAAAAAAAADjIwOC42Ny4yMjAuMjIwILc1EUAgbyJdPivYItf9aR6hwzzI1maNDL4Ev6vKQ_t5GzIuZG5zY3J5cHQtY2VydC5vcGVuZG5zLmNvbQ
sdns://AQMAAAAAAAAADDkuOS45Ljk6ODQ0MyBnyEe4yHWM0SAkVUO-dWdG3zTfHYTAC4xHA2jfgh2GPhkyLmRuc2NyeXB0LWNlcnQucXVhZDkubmV0
sdns://AQMAAAAAAAAAEjEwMy44Ny42OC4xOTQ6ODQ0MyAxXDKkdrOao8ZeLyu7vTnVrT0C7YlPNNf6trdMkje7QR8yLmRuc2NyeXB0LWNlcnQuZG5zLmJlYmFzaWQuY29t
sdns://AQIAAAAAAAAAETk0LjE0MC4xNC4xNDo1NDQzINErR_JS3PLCu_iZEIbq95zkSV2LFsigxDIuUso_OQhzIjIuZG5zY3J5cHQuZGVmYXVsdC5uczEuYWRndWFyZC5jb20
sdns://AQAAAAAAAAAACjguMjAuMjQ3LjIg0sJUqpYcHsoXmZb1X7yAHwg2xyN5q1J-zaiGG-Dgs7AoMi5kbnNjcnlwdC1jZXJ0LnNoaWVsZC0yLmRuc2J5Y29tb2RvLmNvbQ
sdns://AgMAAAAAAAAADDk0LjE0MC4xNS4xNSCaOjT3J965vKUQA9nOnDn48n3ZxSQpAcK6saROY1oCGQ9kbnMuYWRndWFyZC5jb20KL2Rucy1xdWVyeQ
andylau004 commented 7 months ago

I'm noticing a much higher response time on v0.107.48 than before, mainly on DNSCrypt servers, which usually was less than 70ms.

But now: resp_time

Servers:

sdns://AQAAAAAAAAAADjIwOC42Ny4yMjAuMjIwILc1EUAgbyJdPivYItf9aR6hwzzI1maNDL4Ev6vKQ_t5GzIuZG5zY3J5cHQtY2VydC5vcGVuZG5zLmNvbQ
sdns://AQMAAAAAAAAADDkuOS45Ljk6ODQ0MyBnyEe4yHWM0SAkVUO-dWdG3zTfHYTAC4xHA2jfgh2GPhkyLmRuc2NyeXB0LWNlcnQucXVhZDkubmV0
sdns://AQMAAAAAAAAAEjEwMy44Ny42OC4xOTQ6ODQ0MyAxXDKkdrOao8ZeLyu7vTnVrT0C7YlPNNf6trdMkje7QR8yLmRuc2NyeXB0LWNlcnQuZG5zLmJlYmFzaWQuY29t
sdns://AQIAAAAAAAAAETk0LjE0MC4xNC4xNDo1NDQzINErR_JS3PLCu_iZEIbq95zkSV2LFsigxDIuUso_OQhzIjIuZG5zY3J5cHQuZGVmYXVsdC5uczEuYWRndWFyZC5jb20
sdns://AQAAAAAAAAAACjguMjAuMjQ3LjIg0sJUqpYcHsoXmZb1X7yAHwg2xyN5q1J-zaiGG-Dgs7AoMi5kbnNjcnlwdC1jZXJ0LnNoaWVsZC0yLmRuc2J5Y29tb2RvLmNvbQ
sdns://AgMAAAAAAAAADDk0LjE0MC4xNS4xNSCaOjT3J965vKUQA9nOnDn48n3ZxSQpAcK6saROY1oCGQ9kbnMuYWRndWFyZC5jb20KL2Rucy1xdWVyeQ

oh, mygod,, I haven't used sdns yet

How to trigger that,?

renatoyamane commented 7 months ago

I haven't used sdns yet How to trigger that?

Just add those SDNS servers from my previous message to your upstream DNS servers list

sdns