瀏覽代碼

logger/journald: unlock OS threads

Managed containerd processes are executed with SysProcAttr.Pdeathsig set
to syscall.SIGKILL so that the managed containerd is automatically
killed along with the daemon. At least, that is the intention. In
practice, the signal is sent to the process when the creating _OS
thread_ dies! If a goroutine exits while locked to an OS thread, the Go
runtime will terminate the thread. If that thread happens to be the
same thread which the subprocess was started from, the subprocess will
be signaled. Prevent the journald driver from sometimes unintentionally
killing child processes by ensuring that all runtime.LockOSThread()
calls are paired with runtime.UnlockOSThread().

Signed-off-by: Cory Snider <csnider@mirantis.com>
Cory Snider 2 年之前
父節點
當前提交
c3a6de9ec8
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      daemon/logger/journald/read.go

+ 1 - 0
daemon/logger/journald/read.go

@@ -404,6 +404,7 @@ func waitUntilFlushedImpl(s *journald) error {
 	go func() {
 		defer close(flushed)
 		runtime.LockOSThread()
+		defer runtime.UnlockOSThread()
 
 		var (
 			j   *sdjournal.Journal