Skip to content

Commit

Permalink
libcontainer/cgroups/fs: fix OCI runtime pause failed
Browse files Browse the repository at this point in the history
For some instance, runc pause still failed with
`ctr: OCI runtime pause failed: unable to freeze: unknown`.

We should let it sleep a longer time for some really very
slow system or machine.

Signed-off-by: Song Zhang <zhangsong34@huawei.com>
  • Loading branch information
Song Zhang authored and botieking98 committed Sep 23, 2024
1 parent 1590491 commit e12061a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libcontainer/cgroups/fs/freezer.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func (s *FreezerGroup) Set(path string, r *configs.Resources) (Err error) {
// Alas, this is still a game of chances, since the real fix
// belong to the kernel (cgroup v2 do not have this bug).

var d time.Duration = 1
for i := 0; i < 1000; i++ {
if i%50 == 49 {
// Occasional thaw and sleep improves
Expand All @@ -79,6 +80,14 @@ func (s *FreezerGroup) Set(path string, r *configs.Resources) (Err error) {
// system.
time.Sleep(10 * time.Microsecond)
}

if i%200 == 199 {
// should sleep a longer time for
// some really very slow machine.
time.Sleep(d * time.Second)
d <<= 1
}

state, err := cgroups.ReadFile(path, "freezer.state")
if err != nil {
return err
Expand Down

0 comments on commit e12061a

Please sign in to comment.