Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error: invalid memory address or nil pointer dereference in v0.107.24 #5518

Closed
3 tasks done
skibbipl opened this issue Feb 20, 2023 · 3 comments
Closed
3 tasks done
Assignees
Milestone

Comments

@skibbipl
Copy link

Prerequisites

  • I have checked the Wiki and Discussions and found no answer

  • I have searched other issues and found no duplicates

  • I want to report a bug and not ask a question

Operating system type

Linux, Other (please mention the version in the description)

CPU architecture

64-bit ARM

Installation

GitHub releases or script from README

Setup

On one machine

AdGuard Home version

0.107.24

Description

What did you do?

Upgraded AdGuarrdHome to latest 0.107.24 version. My AdGuardHome is behind haproxy which terminates https. I'm using ARM64 version on odroidn2 SBC with Armbian.

Expected result

DoH working without issues

Actual result

DoH broken on RethinkDNS on my Android Phone.

Additional information

After checking verbose logs I can see a lot of errors like this:

2023/02/20 14:49:54.168911 2304983#1390 [debug] github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).ServeHTTP(): Incoming HTTPS request on /dns-query
2023/02/20 14:49:54.169186 2304983#1390 [debug] github.com/AdguardTeam/dnsproxy/proxy.remoteAddr(): Using IP address from HTTP request: 192.168.1.9
2023/02/20 14:49:54.169355 2304983#1390 [debug] request came from proxy server 192.168.1.4:54756
2023/02/20 14:49:54.169566 2304983#1390 [debug] github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).logDNSMessage(): IN: ;; opcode: QUERY, status: NOERROR, id: 0
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version 0; flags: ; udp: 4096
; SUBNET: 0.0.0.0/0/0
; PADDING: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

;; QUESTION SECTION:
;xxxx.domain.tld.       IN       HTTPS

2023/02/20 14:49:54.170031 2304983#1390 [debug] web: plain: http: panic serving 192.168.1.4:54756: runtime error: invalid memory address or nil pointer dereference
goroutine 1390 [running]:
net/http.(*conn).serve.func1()
        net/http/server.go:1850 +0xb8
panic({0x7ef480, 0x19ba190})
        runtime/panic.go:890 +0x260
github.com/AdguardTeam/AdGuardHome/internal/dnsforward.clientServerName(0x1da?, {0x8f87c8, 0x5})
        github.com/AdguardTeam/AdGuardHome/internal/dnsforward/clientid.go:154 +0x238
github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(*Server).clientIDFromDNSContext(0x4000458000, 0x400042df00?)
        github.com/AdguardTeam/AdGuardHome/internal/dnsforward/clientid.go:133 +0x158
github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(*Server).beforeRequestHandler(0x4000458000, 0x63f37a82?, 0x400042df00)
        github.com/AdguardTeam/AdGuardHome/internal/dnsforward/filter.go:22 +0x2c
github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).handleDNSRequest(0x40001aaa80, 0x400042df00)
        github.com/AdguardTeam/dnsproxy@v0.47.1-0.20230207130636-533058b17239/proxy/server.go:91 +0x98
github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).ServeHTTP(0x40001aaa80, {0x145da30?, 0x4000975a40}, 0x400042de00)
        github.com/AdguardTeam/dnsproxy@v0.47.1-0.20230207130636-533058b17239/proxy/server_https.go:161 +0x784
github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(*Server).ServeHTTP(0x4000bc86c0?, {0x145da30, 0x4000975a40}, 0x723514?)
        github.com/AdguardTeam/AdGuardHome/internal/dnsforward/dnsforward.go:683 +0x3c
github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(*Server).handleDoH(0x4000458000, {0x145da30, 0x4000975a40}, 0x400042de00)
        github.com/AdguardTeam/AdGuardHome/internal/dnsforward/http.go:711 +0x54
github.com/AdguardTeam/AdGuardHome/internal/home.postInstall.func1({0x145da30, 0x4000975a40}, 0x400042de00)
        github.com/AdguardTeam/AdGuardHome/internal/home/control.go:383 +0x110
net/http.HandlerFunc.ServeHTTP(0x40005a57b8?, {0x145da30?, 0x4000975a40?}, 0x40004643f0?)
        net/http/server.go:2109 +0x38
net/http.(*ServeMux).ServeHTTP(0x841840?, {0x145da30, 0x4000975a40}, 0x400042de00)
        net/http/server.go:2487 +0x140
github.com/AdguardTeam/AdGuardHome/internal/home.limitRequestBody.func1({0x145da30, 0x4000975a40}, 0x400042dd00)
        github.com/AdguardTeam/AdGuardHome/internal/home/middlewares.go:75 +0x308
net/http.HandlerFunc.ServeHTTP(0x77?, {0x145da30?, 0x4000975a40?}, 0x77?)
        net/http/server.go:2109 +0x38
golang.org/x/net/http2/h2c.h2cHandler.ServeHTTP({{0x1457480?, 0x400011c348?}, 0x4000108aa0?}, {0x145da30, 0x4000975a40}, 0x400042dd00)
        golang.org/x/net@v0.7.0/http2/h2c/h2c.go:125 +0x424
net/http.serverHandler.ServeHTTP({0x145a690?}, {0x145da30, 0x4000975a40}, 0x400042dd00)
        net/http/server.go:2947 +0x2cc
net/http.(*conn).serve(0x4000b5f540, {0x145e630, 0x40000b4c30})
        net/http/server.go:1991 +0x544
created by net/http.(*Server).Serve
        net/http/server.go:3102 +0x43c
@ainar-g ainar-g self-assigned this Feb 20, 2023
@ainar-g ainar-g added this to the v0.107.25 milestone Feb 20, 2023
adguard pushed a commit that referenced this issue Feb 20, 2023
Updates #5425.
Updates #5518.

Squashed commit of the following:

commit 74873bd
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 20 17:54:44 2023 +0300

    dnsforward: use Host when available

commit 4eee3d6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 20 17:24:24 2023 +0300

    dnsforward: fix panic on unencrypted doh
@ainar-g
Copy link
Contributor

ainar-g commented Feb 20, 2023

@skibbipl, thank you for your report. Could you test the latest version, v0.108.0-a.440+a556ce8f, from the Edge channel?

@skibbipl
Copy link
Author

skibbipl commented Feb 20, 2023

Ok, found the build. No problems - DoH seems to be working fine.

@jakeweary
Copy link

Works like a charm again, thanks for the fix! 👍

heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Updates AdguardTeam#5425.
Updates AdguardTeam#5518.

Squashed commit of the following:

commit 74873bd
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 20 17:54:44 2023 +0300

    dnsforward: use Host when available

commit 4eee3d6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Mon Feb 20 17:24:24 2023 +0300

    dnsforward: fix panic on unencrypted doh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants