Skip to content

Commit 650719a

Browse files
committed
increase chan size to fix oom event lost
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
1 parent 8c81c66 commit 650719a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

cgroup2/manager.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ func (c *Manager) memoryEventNonBlockFD() (_ *os.File, retErr error) {
796796
}
797797

798798
func (c *Manager) EventChan() (<-chan Event, <-chan error) {
799-
ec := make(chan Event, 1)
799+
ec := make(chan Event, 16)
800800
errCh := make(chan error, 1)
801801

802802
fd, err := c.memoryEventNonBlockFD()
@@ -821,12 +821,6 @@ func (c *Manager) EventChan() (<-chan Event, <-chan error) {
821821
continue
822822
}
823823

824-
// Check cgroup.events first
825-
shouldExit := false
826-
if c.isCgroupEmpty() {
827-
shouldExit = true
828-
}
829-
830824
out := make(map[string]uint64)
831825
if err := readKVStatsFile(c.path, "memory.events", out); err != nil {
832826
// When cgroup is deleted read may return -ENODEV instead of -ENOENT from open.
@@ -844,7 +838,7 @@ func (c *Manager) EventChan() (<-chan Event, <-chan error) {
844838
OOMKill: out["oom_kill"],
845839
}
846840

847-
if shouldExit {
841+
if c.isCgroupEmpty() {
848842
return
849843
}
850844
}

0 commit comments

Comments
 (0)