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:
parent
48f6b9981a
commit
3190c1c53d
@ -22,6 +22,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/cadvisor/utils"
|
"github.com/google/cadvisor/utils"
|
||||||
@ -167,6 +168,9 @@ func (self *OomParser) StreamOoms(outStream chan *OomInstance) {
|
|||||||
|
|
||||||
func callJournalctl() (io.ReadCloser, error) {
|
func callJournalctl() (io.ReadCloser, error) {
|
||||||
cmd := exec.Command("journalctl", "-k", "-f")
|
cmd := exec.Command("journalctl", "-k", "-f")
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
|
Pdeathsig: syscall.SIGKILL,
|
||||||
|
}
|
||||||
readcloser, err := cmd.StdoutPipe()
|
readcloser, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user