Repository: AdguardTeam/AdGuardHome

Issue #6304: SIGSEGV: segmentation violation when clearing query log
Created: 2023-10-12T16:13:22Z
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 or ask for help


 I have set up AdGuard Home correctly and configured clients to use it. (Use the Discussions for help with installing and configuring clients.)


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

Duplicate issue #6308: Clearing Logs and Stats Crashing AdguardHome v0.107.39
Created: 2023-10-12T19:13:25Z
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 or ask for help


 I have set up AdGuard Home correctly and configured clients to use it. (Use the Discussions for help with installing and configuring clients.)


Platform (OS and CPU architecture)
FreeBSD, 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
v0.107.39
Action
Clearing Logs and Stats
Expected result
Logs and Stats to be cleared - requiring no reboot or restart of service or reboot.
Actual result
AdguardHome crashes.
Additional information and/or screenshots
pfSense
23.05.1-RELEASE (amd64)built on Wed Jun 28 03:57:27 UTC 2023FreeBSD 14.0-CURRENT
Have this when going immediately to dashboard. Unsure if this is my reverse proxy becoming an issue to the problem when Adguard crashes. Once this shows, refreshing doesn't take me to Adguard anymore and I simply reboot pfSense.

Closing comment (2023-10-12T19:14:16Z): Duplicate of #6304.