Merge pull request #35253 from Microsoft/jjh/startuplogging

Windows: Fix startup logging
This commit is contained in:
Vincent Demeester 2017-10-23 18:43:41 +02:00 committed by GitHub
commit 2058854c4b
2 changed files with 8 additions and 6 deletions

View File

@ -58,9 +58,10 @@ func (cli *DaemonCli) setupConfigReloadTrap() {
sa := windows.SecurityAttributes{
Length: 0,
}
ev, _ := windows.UTF16PtrFromString("Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid()))
event := "Global\\docker-daemon-config-" + fmt.Sprint(os.Getpid())
ev, _ := windows.UTF16PtrFromString(event)
if h, _ := windows.CreateEvent(&sa, 0, 0, ev); h != 0 {
logrus.Debugf("Config reload - waiting signal at %s", ev)
logrus.Debugf("Config reload - waiting signal at %s", event)
for {
windows.WaitForSingleObject(h, windows.INFINITE)
cli.reloadConfig()

View File

@ -15,10 +15,11 @@ func (d *Daemon) setupDumpStackTrap(root string) {
// Windows does not support signals like *nix systems. So instead of
// trapping on SIGUSR1 to dump stacks, we wait on a Win32 event to be
// signaled. ACL'd to builtin administrators and local system
ev, _ := windows.UTF16PtrFromString("Global\\docker-daemon-" + fmt.Sprint(os.Getpid()))
event := "Global\\docker-daemon-" + fmt.Sprint(os.Getpid())
ev, _ := windows.UTF16PtrFromString(event)
sd, err := winio.SddlToSecurityDescriptor("D:P(A;;GA;;;BA)(A;;GA;;;SY)")
if err != nil {
logrus.Errorf("failed to get security descriptor for debug stackdump event %s: %s", ev, err.Error())
logrus.Errorf("failed to get security descriptor for debug stackdump event %s: %s", event, err.Error())
return
}
var sa windows.SecurityAttributes
@ -27,11 +28,11 @@ func (d *Daemon) setupDumpStackTrap(root string) {
sa.SecurityDescriptor = uintptr(unsafe.Pointer(&sd[0]))
h, err := windows.CreateEvent(&sa, 0, 0, ev)
if h == 0 || err != nil {
logrus.Errorf("failed to create debug stackdump event %s: %s", ev, err.Error())
logrus.Errorf("failed to create debug stackdump event %s: %s", event, err.Error())
return
}
go func() {
logrus.Debugf("Stackdump - waiting signal at %s", ev)
logrus.Debugf("Stackdump - waiting signal at %s", event)
for {
windows.WaitForSingleObject(h, windows.INFINITE)
path, err := signal.DumpStacks(root)