Browse code

Start the stack trap earlier for daemon

That way we can get stack dump earlier if there is something that
locks the daemon during start/restore phase.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Vincent Demeester authored on 2017/04/04 23:23:14
Showing 1 changed files
... ...
@@ -526,6 +526,14 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe
526 526
 		}
527 527
 	}()
528 528
 
529
+	// set up SIGUSR1 handler on Unix-like systems, or a Win32 global event
530
+	// on Windows to dump Go routine stacks
531
+	stackDumpDir := config.Root
532
+	if execRoot := config.GetExecRoot(); execRoot != "" {
533
+		stackDumpDir = execRoot
534
+	}
535
+	d.setupDumpStackTrap(stackDumpDir)
536
+
529 537
 	if err := d.setupSeccompProfile(); err != nil {
530 538
 		return nil, err
531 539
 	}
... ...
@@ -714,14 +722,6 @@ func NewDaemon(config *config.Config, registryService registry.Service, containe
714 714
 	engineCpus.Set(float64(info.NCPU))
715 715
 	engineMemory.Set(float64(info.MemTotal))
716 716
 
717
-	// set up SIGUSR1 handler on Unix-like systems, or a Win32 global event
718
-	// on Windows to dump Go routine stacks
719
-	stackDumpDir := config.Root
720
-	if execRoot := config.GetExecRoot(); execRoot != "" {
721
-		stackDumpDir = execRoot
722
-	}
723
-	d.setupDumpStackTrap(stackDumpDir)
724
-
725 717
 	return d, nil
726 718
 }
727 719