AdguardTeam/AdGuardHome · warning
shutting down dnssvc: %w
Error message
shutting down dnssvc: %w
What it means
Graceful shutdown of the DNS server failed; joined with the web shutdown error via errors.Join and reported after removePID.
Source
Thrown at internal/next/cmd/service.go:116
s.logger.DebugContext(ctx, "wrote pid", "file", s.pidFilePath, "pid", pid)
}
// Shutdown implements the [service.Interface] interface for *serviceMgr.
func (s *serviceMgr) Shutdown(ctx context.Context) (err error) {
s.confMgrMu.RLock()
defer s.confMgrMu.RUnlock()
var errs []error
err = s.confMgr.Web().Shutdown(ctx)
if err != nil {
errs = append(errs, fmt.Errorf("shutting down web: %w", err))
}
err = s.confMgr.DNS().Shutdown(ctx)
if err != nil {
errs = append(errs, fmt.Errorf("shutting down dnssvc: %w", err))
}
s.removePID(ctx)
return errors.Join(errs...)
}
// removePID removes the PID file. Any errors are reported to log.
func (s *serviceMgr) removePID(ctx context.Context) {
if s.pidFilePath == "" {
return
}
err := os.Remove(s.pidFilePath)
if err != nil {
s.logger.ErrorContext(ctx, "removing pidfile", slogutil.KeyError, err)
returnView on GitHub (pinned to b41aefbe51)
Solutions
- Widen the shutdown deadline for the Refresh/Shutdown context
- Reduce load or wait for query drain before reconfiguring
- Check logs for stuck handlers if persistent
Defensive patterns
Strategy: retry
Try / catch
if err := s.Shutdown(ctx); err != nil {
log.Warnf("shutdown issues (may be drain timeouts): %v", err)
if !procExited() { /* escalate: force kill */ }
} Prevention
- Drain DNS traffic before reconfiguration windows
- Monitor for stuck handlers via metrics/logging
When it happens
Trigger: confMgr.DNS().Shutdown(ctx) errors: context deadline exceeded while draining queries, socket close errors, or UDP goroutines stuck.
Common situations: Refresh under heavy DNS load where in-flight queries exceed the shutdown window; rare fd/socket errors on shutdown during container teardown.
Related errors
- shutting down web: %w
- parsing json time: %w
- json time is nil
- shutting down watcher: %w
- invalid upstream servers: %w
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/207a3da186bd90f7.
Report an issue: GitHub.