AdguardTeam/AdGuardHome · warning
shutting down web: %w
Error message
shutting down web: %w
What it means
Graceful shutdown of the web server failed (confMgr.Web().Shutdown); joined with any DNS shutdown error. Usually a timeout waiting for in-flight connections to drain.
Source
Thrown at internal/next/cmd/service.go:111
if err != nil {
s.logger.ErrorContext(ctx, "writing pidfile", slogutil.KeyError, err)
return
}
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
}
View on GitHub (pinned to b41aefbe51)
Solutions
- Increase the shutdown timeout/context deadline
- Ensure clients/health-checkers close idle connections
- If benign (during restart), verify the process actually exits and the new instance starts
Example fix
// before ctx, cancel := context.WithTimeout(ctx, 1*time.Second) // after ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
Defensive patterns
Strategy: retry
Try / catch
err := s.Shutdown(ctx)
if err != nil {
var joined interface{ Unwrap() []error }
if errors.As(err, &joined) { /* inspect each; tolerate web drain timeouts */ }
} Prevention
- Give Shutdown a generous context deadline
- Close idle keep-alive clients (load balancers, monitors) before shutdown
When it happens
Trigger: Shutdown context expires while HTTP keep-alive connections or long requests (e.g. large queries, slow clients) refuse to close.
Common situations: Refresh/reconfigure flow where the shutdown context is too short and clients hold connections open.
Related errors
- shutting down dnssvc: %w
- shutting down watcher: %w
- starting web: %w
- shutdown failed: %w
- opening transaction: %w
AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27).
Data as JSON: /api/errors/ddcb3885feb2a061.
Report an issue: GitHub.