vitessio/vitess · info

received signal: %v

Error message

received signal: %v

What it means

grpcserver.Server installs a signal handler for SIGTERM/SIGQUIT; when one arrives it constructs an error "received signal: %v" and sends it to the shutdown channel, triggering graceful shutdown. This is not an unexpected failure — it is the server's deliberate mechanism to convert OS signals into a shutdown cause so in-flight work can be logged and drained.

Source

Thrown at go/vt/vtadmin/grpcserver/server.go:221

	lmux := cmux.New(lis)

	if s.opts.CMuxReadTimeout > 0 {
		lmux.SetReadTimeout(s.opts.CMuxReadTimeout)
	}

	grpcLis := lmux.MatchWithWriters(cmux.HTTP2MatchHeaderFieldSendSettings("content-type", "application/grpc"))
	anyLis := lmux.Match(cmux.Any())

	shutdown := make(chan error, 16)

	signals := make(chan os.Signal, 8)
	signal.Notify(signals, syscall.SIGTERM, syscall.SIGQUIT)

	// listen for signals
	go func() {
		sig := <-signals
		err := fmt.Errorf("received signal: %v", sig)
		log.Warn(fmt.Sprint(err))
		shutdown <- err
	}()

	if s.opts.MetricsEndpoint != "" {
		if !strings.HasPrefix(s.opts.MetricsEndpoint, "/") {
			s.opts.MetricsEndpoint = "/" + s.opts.MetricsEndpoint
		}

		grpc_prometheus.Register(s.gRPCServer)
		s.router.Handle(s.opts.MetricsEndpoint, promhttp.Handler())
	}

	// Start the servers
	go func() {
		err := s.gRPCServer.Serve(grpcLis)
		err = fmt.Errorf("grpc server stopped: %w", err)
		log.Warn(fmt.Sprint(err))

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. No fix needed if the shutdown was intentional — this is the graceful-shutdown path.
  2. If unexpected, audit what sends SIGTERM/SIGQUIT (orchestrator, watchdogs, OOM-adjacent tooling).
  3. Check shutdown handling after this error to confirm connections drained cleanly.
  4. For k8s, tune terminationGracePeriodSeconds so shutdown completes in time.
Defensive patterns

Strategy: try-catch

Try / catch

if err := server.ListenAndServe(ctx); err != nil {
  if strings.HasPrefix(err.Error(), "received signal:") {
    log.Info("vtadmin stopped by signal; exiting cleanly")
    return nil
  }
  return err
}

Prevention

When it happens

Trigger: The process receives SIGTERM (systemd/k8s stop, docker stop) or SIGQUIT (manual kill -QUIT) while ListenAndServe is running; the goroutine at server.go:221 forwards it to shutdown.

Common situations: Kubernetes rolling deploys sending SIGTERM to pods; operators restarting vtadmin; CI teardown killing the process; seeing this in logs and mistaking an intentional stop for a crash.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/fef3dc7f62de047c. Report an issue: GitHub.