Fix journalctl leak

This fixes the journalctl leak that occurs when a process that uses
cadvisor exits. See issues #1725 and
https://github.com/kubernetes/kubernetes/issues/34965.
This commit is contained in:
Michael Taufen 2017-08-23 09:14:52 -07:00
parent 48f6b9981a
commit 3190c1c53d

View File

@ -22,6 +22,7 @@ import (
"path"
"regexp"
"strconv"
"syscall"
"time"
"github.com/google/cadvisor/utils"
@ -167,6 +168,9 @@ func (self *OomParser) StreamOoms(outStream chan *OomInstance) {
func callJournalctl() (io.ReadCloser, error) {
cmd := exec.Command("journalctl", "-k", "-f")
cmd.SysProcAttr = &syscall.SysProcAttr{
Pdeathsig: syscall.SIGKILL,
}
readcloser, err := cmd.StdoutPipe()
if err != nil {
return nil, err