dmachard / go-dnscollector

Ingesting, pipelining, and enhancing your DNS logs with usage indicators, security analysis, and additional metadata.
MIT License
215 stars 48 forks source link

panic: close of closed channel during "telemetry is stopping" #836

Open dmachard opened 1 month ago

dmachard commented 1 month ago

Describe the bug

DNS collector is stopping and a second SIGTERM is received.

INFO: 2024/10/07 20:55:59.716423 main - telemetry is stopping INFO: 2024/10/07 20:55:59.716495 worker - [sniffer] afpacket sniffer - stopping monitor... INFO: 2024/10/07 20:55:59.716507 worker - [sniffer] afpacket sniffer - monitor terminated INFO: 2024/10/07 20:55:59.716513 worker - [sniffer] afpacket sniffer - stopping collect... INFO: 2024/10/07 20:55:59.716522 worker - [sniffer] afpacket sniffer - stop to listen...

^CINFO: 2024/10/07 20:56:00.368060 worker - [sniffer] afpacket sniffer - stopping sniffer... INFO: 2024/10/07 20:56:00.371885 worker - [sniffer] dns processor - stopping monitor... INFO: 2024/10/07 20:56:00.371913 worker - [sniffer] dns processor - monitor terminated INFO: 2024/10/07 20:56:00.371923 worker - [sniffer] dns processor - stopping collect... INFO: 2024/10/07 20:56:00.371931 worker - [sniffer] dns processor - collection terminated INFO: 2024/10/07 20:56:00.371947 worker - [sniffer] afpacket sniffer - read data terminated INFO: 2024/10/07 20:56:00.371959 worker - [sniffer] afpacket sniffer - collection terminated INFO: 2024/10/07 20:56:00.371972 worker - [console] stdout - stopping monitor... INFO: 2024/10/07 20:56:00.371980 worker - [console] stdout - monitor terminated INFO: 2024/10/07 20:56:00.371992 worker - [console] stdout - stopping collect... INFO: 2024/10/07 20:56:00.372003 worker - [console] stdout - logging terminated INFO: 2024/10/07 20:56:00.372017 worker - [console] stdout - collection terminated WARNING: 2024/10/07 20:56:00.372029 main - exiting... INFO: 2024/10/07 20:56:00.372035 main - telemetry is stopping INFO: 2024/10/07 20:56:00.372088 main - stopped panic: close of closed channel

goroutine 24 [running]: github.com/dmachard/go-dnscollector/telemetry.(*PrometheusCollector).Stop(...) /home/denis/Lab/go-dnscollector/telemetry/prometheus.go:149 main.main.func1() /home/denis/Lab/go-dnscollector/dnscollector.go:225 +0x354 created by main.main in goroutine 1 /home/denis/Lab/go-dnscollector/dnscollector.go:191 +0x9e5 exit status 2