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

SIGSEGV: segmentation violation when clearing query log #6304

Closed
4 tasks done
trippleflux opened this issue Oct 12, 2023 · 3 comments
Closed
4 tasks done

SIGSEGV: segmentation violation when clearing query log #6304

trippleflux opened this issue Oct 12, 2023 · 3 comments
Assignees
Milestone

Comments

@trippleflux
Copy link

trippleflux commented Oct 12, 2023

Prerequisites

Platform (OS and CPU architecture)

Linux, AMD64 (aka x86_64)

Installation

Custom package (OpenWrt, HomeAssistant, etc; please mention in the description)

Setup

On a router, DHCP is handled by the router

AdGuard Home version

d3fabdd

Action

Ater clearing out :

  • Clear Cache
  • Clear Query logs
  • Celar Statistics

My adguardhome will segmentation fault :

Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.564246 [info] dnsproxy: stopping dns proxy server
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.566545 [info] dnsproxy: stopped dns proxy server
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667224 [info] dnsproxy: cache: enabled, size 4096 b
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667244 [info] dnsproxy: max goroutines is set to 300
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667656 [info] dnsproxy: starting dns proxy server
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667677 [info] Cache TTL override is enabled. Min=3600, Max=86400
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667681 [info] The server is configured to refuse ANY requests
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667685 [info] dnsproxy: cache: enabled, size 419430400 b
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667690 [info] dnsproxy: max goroutines is set to 300
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667706 [info] dnsproxy: creating udp server socket 10.10.8.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667775 [info] dnsproxy: listening to udp://10.10.8.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667783 [info] dnsproxy: creating udp server socket 127.0.0.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667783 [info] clients: processing addresses
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667814 [info] dnsproxy: listening to udp://127.0.0.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667823 [info] dnsproxy: creating tcp server socket 10.10.8.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667852 [info] dnsproxy: listening to tcp://10.10.8.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667857 [info] dnsproxy: creating tcp server socket 127.0.0.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667872 [info] dnsproxy: listening to tcp://127.0.0.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667886 [info] dnsforward: finished reconfiguring server
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667927 [info] dnsproxy: entering udp listener loop on 127.0.0.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667932 [info] dnsproxy: entering tcp listener loop on 10.10.8.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667965 [info] dnsproxy: entering udp listener loop on 10.10.8.1:53
Thu Oct 12 23:06:13 2023 daemon.err AdGuardHome[14466]: 2023/10/12 23:06:13.667974 [info] dnsproxy: entering tcp listener loop on 127.0.0.1:53
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: panic: runtime error: invalid memory address or nil pointer dereference
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0xb1188c]
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]:
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: goroutine 60710 [running]:
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/AdGuardHome/internal/aghalg.(*RingBuffer[...]).Append(...)
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/AdGuardHome/internal/aghalg/ringbuffer.go:28
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/AdGuardHome/internal/querylog.(*queryLog).Add(0xc0001e75e0, 0xc00058f980)
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/AdGuardHome/internal/querylog/qlog.go:228 +0x1ec
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(*Server).logQuery(0xc00037ea00, 0xc0019ca900, 0xc00026af00, 0x59d5ed, {0xc003f22598, 0x4, 0x8})
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/AdGuardHome/internal/dnsforward/stats.go:131 +0x296
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(*Server).processQueryLogsAndStats(0xc00037ea00, 0xc0019ca900)
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/AdGuardHome/internal/dnsforward/stats.go:46 +0x4f3
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/AdGuardHome/internal/dnsforward.(*Server).handleDNSRequest(0xc00037ea00, 0xe27ca0?, 0xc00026af00)
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/AdGuardHome/internal/dnsforward/process.go:130 +0x39e
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).handleDNSRequest(0xc0018be000, 0xc00026af00)
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/dnsproxy@v0.56.1/proxy/server.go:131 +0x405
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).udpHandlePacket(0xc0018be000, {0xc001cff320, 0x24, 0x24}, {0xc019592c4c, 0x4, 0x4}, 0xc0020d5ec0, 0xc0001797c0)
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/dnsproxy@v0.56.1/proxy/server_udp.go:115 +0x2d8
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).udpPacketLoop.func1()
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/dnsproxy@v0.56.1/proxy/server_udp.go:82 +0x49
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: created by github.com/AdguardTeam/dnsproxy/proxy.(*Proxy).udpPacketLoop in goroutine 60581
Thu Oct 12 23:06:31 2023 daemon.err AdGuardHome[14466]: 	github.com/AdguardTeam/dnsproxy@v0.56.1/proxy/server_udp.go:81 +0x38e

On OpenWrt latest snapshot (Glibc 2.38, Kernel 6.1.56), I need to restart adguardhome process in order to restore functionalities.

Expected result

Doesn't segmentation fault after clearing it out all caches

Actual result

Segmentation fault after clearing it out all caches

Additional information and/or screenshots

No response

@ainar-g ainar-g added this to the v0.107.40 milestone Oct 12, 2023
@ainar-g ainar-g pinned this issue Oct 12, 2023
@ainar-g ainar-g changed the title SIGSEGV: segmentation violation SIGSEGV: segmentation violation when clearing query log Oct 12, 2023
adguard pushed a commit that referenced this issue Oct 12, 2023
Updates #6304.

Squashed commit of the following:

commit 7382630
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Oct 12 19:37:01 2023 +0300

    all: upd chlog

commit ff9a82a
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Oct 12 19:27:35 2023 +0300

    querylog: fix ring buffer
@schzhn
Copy link
Member

schzhn commented Oct 12, 2023

We've pushed the edge release containing the fix.

@yyysuo
Copy link

yyysuo commented Oct 13, 2023

v0.108.0-a.729+506d7131 have fixed this issue. Thanks.

@trippleflux
Copy link
Author

@ainar-g
Confirm fixed, thanks.

@ainar-g ainar-g modified the milestones: v0.107.41, v0.107.37, v0.107.40 Oct 18, 2023
@ainar-g ainar-g unpinned this issue Oct 20, 2023
annguyen0 pushed a commit to annguyen0/AdGuardHome that referenced this issue Nov 27, 2023
Updates AdguardTeam#6304.

Squashed commit of the following:

commit 7382630
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Oct 12 19:37:01 2023 +0300

    all: upd chlog

commit ff9a82a
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date:   Thu Oct 12 19:27:35 2023 +0300

    querylog: fix ring buffer
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

5 participants
@trippleflux @ainar-g @yyysuo @schzhn and others