-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
kind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)topic/cleanupTopic cleanupTopic cleanuptopic/daemon + init
Milestone
Description
485 // listen for and handle SIGTERM
486 func (i *cmdInvocation) setupInterruptHandler() {
487
488 ctx := i.req.Context()
489 sig := allInterruptSignals()
490
491 go func() {
492 // first time, try to shut down.
493
494 // loop because we may be
495 for count := 0; ; count++ {
496 <-sig
497
498 n, err := ctx.GetNode() // shouldn't be accessed from client process
499 if err != nil {
500 log.Error(err)
501 log.Critical("Received interrupt signal, terminating...")
502 os.Exit(-1)
503 }
504
505 switch count {
506 case 0:
507 log.Critical("Received interrupt signal, shutting down...")
508 go func() {
509 n.Close()
510 log.Info("Gracefully shut down.")
511 }()
512
513 default:
514 log.Critical("Received another interrupt before graceful shutdown, terminating...")
515 os.Exit(-1)
516 }
517 }
518 }()
519 }Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind/bugA bug in existing code (including security flaws)A bug in existing code (including security flaws)topic/cleanupTopic cleanupTopic cleanuptopic/daemon + init