Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses a lot of CPU when idle #5089

Closed
baryluk opened this issue Feb 25, 2021 · 12 comments · Fixed by #9795
Closed

Uses a lot of CPU when idle #5089

baryluk opened this issue Feb 25, 2021 · 12 comments · Fixed by #9795
Labels

Comments

@baryluk
Copy link

baryluk commented Feb 25, 2021

After installing containerd Version: 1.4.3~ds1-2 on Debian testing from Debian, I noticed it is almost always at the top of the top output, sometimes using 10% CPU.

This is a fresh installation of containerd with nothing configured.

This is wasteful, and prevents CPU and system to go into deeper sleep mode, which is important on laptops, but also on desktop. It also interferes with very accurate time measurements of other programs.

Running strace -f on the running process shows that is is using a very frequently futex and short sleep of 20us.

Consider using epool with multi-second timeout, and possibly eventfd for futex waits (which can be be epool-ed on too), instead of explicit pooling with no timeout and nanosleep.

Or maybe my diagnosis is wrong, as I see a lot of futex wakes, despite me doing absolutly nothing with containerd.

A ~3 seconds sample of strace in the attachment.

containerd-strace.txt

@baryluk
Copy link
Author

baryluk commented Feb 25, 2021

Here is a high resolution capture of CPU usage of containerd process in time:

$ ~/vps1/home/baryluk/Projekty/multimonitor/multimonitor_ldc --process containerd
# ProcStat Initializing ticks_per_second
# ProcStat Initializing page_size_kb
# Arguments: ["/home/user/vps1/home/baryluk/Projekty/multimonitor/multimonitor_ldc", "--process", "containerd"]
# For process name containerd found pids: [1340531]
        UNIX-TIME            TIME      RELTIME      CPU%        RSS
1614290959.898887   365175.366936     0.200070     0.00%      44MiB
1614290960.098889   365175.566887     0.400020    10.00%      44MiB
1614290960.298890   365175.766940     0.600074     5.00%      44MiB
1614290960.498892   365175.966912     0.800046     0.00%      44MiB
1614290960.698893   365176.166896     1.000030     5.00%      44MiB
1614290960.898895   365176.366918     1.200051     0.00%      44MiB
1614290961.098896   365176.566894     1.400028     0.00%      44MiB
1614290961.298898   365176.766905     1.600039     5.00%      44MiB
1614290961.498900   365176.966900     1.800034     0.00%      44MiB
1614290961.698901   365177.166911     2.000045     0.00%      44MiB
1614290961.898903   365177.366916     2.200050     5.00%      44MiB
1614290962.098904   365177.566893     2.400027     0.00%      44MiB
1614290962.298906   365177.767036     2.600170     5.00%      44MiB
1614290962.498907   365177.966852     2.799986     0.00%      44MiB
1614290962.698909   365178.167001     3.000135     0.00%      44MiB
1614290962.898911   365178.366867     3.200001     5.00%      44MiB
1614290963.098912   365178.566919     3.400052     0.00%      44MiB
1614290963.298914   365178.766912     3.600046     5.00%      44MiB
1614290963.498915   365178.967016     3.800149     5.00%      44MiB
1614290963.698917   365179.166861     3.999994     0.00%      44MiB
1614290963.898918   365179.366916     4.200049     5.00%      44MiB
1614290964.098920   365179.566897     4.400030     0.00%      44MiB
1614290964.298922   365179.766923     4.600057    10.00%      44MiB
1614290964.498923   365179.966910     4.800044     0.00%      44MiB
1614290964.698925   365180.166910     5.000044     5.00%      44MiB
1614290964.898926   365180.366892     5.200026     5.00%      44MiB
1614290965.098928   365180.566908     5.400042     0.00%      44MiB
1614290965.298929   365180.766913     5.600047    10.00%      44MiB

It should be 0.00% non-stop instead.

@cpuguy83
Copy link
Member

I think this is mostly all related to the go runtime.
Running this through pprof does not indicate anything abnormal or unexpected.

@fuweid
Copy link
Member

fuweid commented Mar 4, 2021

@baryluk you can run ctr pprof profile > cpu.profile to dump the profile if you enable debug mode.

@baryluk
Copy link
Author

baryluk commented Mar 5, 2021

cpu-profile.zip

(pprof) top
Showing nodes accounting for 180ms, 100% of 180ms total
Showing top 10 nodes out of 21
      flat  flat%   sum%        cum   cum%
      50ms 27.78% 27.78%       50ms 27.78%  runtime.epollwait
      30ms 16.67% 44.44%      160ms 88.89%  runtime.findrunnable
      20ms 11.11% 55.56%       20ms 11.11%  runtime.futex
      20ms 11.11% 66.67%       30ms 16.67%  runtime.runqsteal
      10ms  5.56% 72.22%       10ms  5.56%  runtime.(*puintptr).set
      10ms  5.56% 77.78%       10ms  5.56%  runtime.(*randomOrder).start
      10ms  5.56% 83.33%       20ms 11.11%  runtime.checkTimers
      10ms  5.56% 88.89%       10ms  5.56%  runtime.mallocgc
      10ms  5.56% 94.44%       10ms  5.56%  runtime.nanotime
      10ms  5.56%   100%       10ms  5.56%  runtime.runqgrab
(pprof) 

another dump with docker also running:

cpu2-profile.zip

user@debian:~$ go tool pprof  cpu.profile 
File: containerd
Build ID: 6671818beaf0197efea311d29288500800166202
Type: cpu
Time: Mar 5, 2021 at 6:02pm (UTC)
Duration: 30s, Total samples = 330ms ( 1.10%)
Entering interactive mode (type "help" for commands, "o" for options)
(pprof) top
Showing nodes accounting for 260ms, 78.79% of 330ms total
Showing top 10 nodes out of 39
      flat  flat%   sum%        cum   cum%
      90ms 27.27% 27.27%       90ms 27.27%  runtime.futex
      50ms 15.15% 42.42%       50ms 15.15%  runtime.epollwait
      20ms  6.06% 48.48%       30ms  9.09%  runtime.checkTimers
      20ms  6.06% 54.55%      180ms 54.55%  runtime.findrunnable
      20ms  6.06% 60.61%       20ms  6.06%  runtime.nanotime (inline)
      20ms  6.06% 66.67%       20ms  6.06%  runtime.runqgrab
      10ms  3.03% 69.70%       20ms  6.06%  github.com/containerd/containerd/gc/scheduler.(*gcScheduler).run
      10ms  3.03% 72.73%       10ms  3.03%  runtime.(*randomEnum).done (inline)
      10ms  3.03% 75.76%       10ms  3.03%  runtime.markBits.isMarked
      10ms  3.03% 78.79%       30ms  9.09%  runtime.notetsleep_internal
(pprof) 

@dmcgowan
Copy link
Member

dmcgowan commented Mar 5, 2021

Watching my system while idle and containerd not running anything, I see it periodically doing something as well. The amount of CPU is likely runtime related as @cpuguy83 said, but when I ran the profile over a period of 5 minutes (of inactivity), 25% was to the dialer, about 70% to runtime, and 1% to some snapshotsSyncer.

That snapshotsSyncer is in the CRI plugin seems to run every 10 seconds and scan all snapshotters regardless of whether there has been any activity. That can definitely be fixed to reduce constant unnecessary CPU usage.

I am not sure about the dialer, whether that is related to the debug socket or something else going on. Either way, having those periodic tasks that run when not needed needs to be cleaned up and would give the runtime less to do.

The GC scheduler has a similar periodic check where it wakes up and checks a flag, I'm not sure if there is a cleaner pattern in Go to trigger that on rather than sleep -> check -> sleep (see https://github.com/containerd/containerd/blob/master/gc/scheduler/scheduler.go#L273)

@niamtokik
Copy link

Hi,

I have the same issue on a fresh Ubuntu 21.04 installation. Containerd from official Ubuntu repository (containerd_1.4.4-0ubuntu1_amd64.deb) and from official Docker repository (containerd.io_1.4.6-1_amd64.deb) are both using around 70% of CPU when idle. I tried to custom containerd scheduler, without success.

When using strace -tttfp $(pgrep containerd), I got this kind of output (still in idle, no containers or jobs running):

[pid 75736] 11:31:57.173758 futex(0x5583f6ce8888, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75737] 11:31:57.173758 restart_syscall(<... resuming interrupted read ...> <unfinished ...>
[pid 75738] 11:31:57.173758 futex(0xc00005e848, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75867] 11:31:57.177758 epoll_wait(5,  <unfinished ...>
[pid 75751] 11:31:57.177758 futex(0xc00005f9c8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75742] 11:31:57.177758 futex(0x5583f6d05600, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75741] 11:31:57.177758 epoll_pwait(4,  <unfinished ...>
[pid 75740] 11:31:57.177758 futex(0x5583f6d054d8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75739] 11:31:57.177758 futex(0xc00005ebc8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75737] 11:31:57.181758 <... restart_syscall resumed>) = 0
[pid 75737] 11:31:57.181758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=893664250}) = 0
[pid 75737] 11:31:57.181758 nanosleep({tv_sec=0, tv_nsec=20000}, NULL) = 0
[pid 75737] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75737] 11:31:57.185758 futex(0xc00005ebc8, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid 75739] 11:31:57.185758 <... futex resumed>) = 0
[pid 75737] 11:31:57.185758 <... futex resumed>) = 1
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>
[pid 75737] 11:31:57.185758 nanosleep({tv_sec=0, tv_nsec=20000},  <unfinished ...>
[pid 75739] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_REALTIME, {tv_sec=1622806317, tv_nsec=185758961}) = 0
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 futex(0xc00005f9c8, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid 75751] 11:31:57.185758 <... futex resumed>) = 0
[pid 75739] 11:31:57.185758 <... futex resumed>) = 1
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>
[pid 75751] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>
[pid 75739] 11:31:57.185758 futex(0x5583f6cec4a0, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=501156750} <unfinished ...>
[pid 75751] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 madvise(0xc000600000, 2097152, MADV_NOHUGEPAGE) = 0
[pid 75751] 11:31:57.185758 madvise(0xc00060c000, 8192, MADV_FREE) = 0
[pid 75751] 11:31:57.185758 madvise(0xc000400000, 4194304, MADV_NOHUGEPAGE) = 0
[pid 75751] 11:31:57.185758 madvise(0xc0005fe000, 40960, MADV_FREE) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 futex(0x5583f6cec4a0, FUTEX_WAKE_PRIVATE, 1) = 1
[pid 75739] 11:31:57.185758 <... futex resumed>) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_REALTIME,  <unfinished ...>
[pid 75739] 11:31:57.185758 futex(0xc00005ebc8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75751] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=1622806317, tv_nsec=185758961}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_REALTIME, {tv_sec=1622806317, tv_nsec=185758961}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 futex(0xc00005ebc8, FUTEX_WAKE_PRIVATE, 1) = 1
[pid 75739] 11:31:57.185758 <... futex resumed>) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_REALTIME,  <unfinished ...>
[pid 75751] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=1622806317, tv_nsec=185758961}) = 0
[pid 75751] 11:31:57.185758 futex(0x5583f6cec4a0, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=1999023} <unfinished ...>
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 futex(0x5583f6cec4a0, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid 75751] 11:31:57.185758 <... futex resumed>) = 0
[pid 75739] 11:31:57.185758 <... futex resumed>) = 1
[pid 75751] 11:31:57.185758 futex(0xc00005f9c8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_REALTIME, {tv_sec=1622806317, tv_nsec=185758961}) = 0
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 futex(0xc00005f9c8, FUTEX_WAKE_PRIVATE, 1 <unfinished ...>
[pid 75751] 11:31:57.185758 <... futex resumed>) = 0
[pid 75739] 11:31:57.185758 <... futex resumed>) = 1
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_REALTIME,  <unfinished ...>
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>
[pid 75751] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=1622806317, tv_nsec=185758961}) = 0
[pid 75739] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC,  <unfinished ...>
[pid 75739] 11:31:57.185758 futex(0x5583f6cec4a0, FUTEX_WAIT_PRIVATE, 0, {tv_sec=0, tv_nsec=1999023} <unfinished ...>
[pid 75751] 11:31:57.185758 <... clock_gettime resumed>{tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75751] 11:31:57.185758 futex(0x5583f6cec4a0, FUTEX_WAKE_PRIVATE, 1) = 1
[pid 75739] 11:31:57.185758 <... futex resumed>) = 0
[pid 75751] 11:31:57.185758 futex(0xc00005f9c8, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_REALTIME, {tv_sec=1622806317, tv_nsec=185758961}) = 0
[pid 75739] 11:31:57.185758 clock_gettime(CLOCK_MONOTONIC, {tv_sec=18395, tv_nsec=897664500}) = 0

@dmcgowan
Copy link
Member

dmcgowan commented Jun 5, 2021

I tried going through and disabling various plugins to see if there was anything obviously increasing the CPU. The overall CPU can be decreased by disabling or making some of the periodically functions more efficient...

  • Have an update to GC I am working on to allow it to wake up less when there is no activity
  • The restart monitor today ends up running periodically and doing checks in the database even if there are no containers
  • The snapshot sync I mentioned before

Disabling/fixing those doesn't do much for the mentioned syscalls. Given the only things left running are the rpc servers and various channel listeners, the calls are likely from the go runtime or go libraries. I'm not seeing anything close to the high CPU usage mentioned, just constant low usage even with nothing running.

We'll continue to look at ways to cut down on idle usage, but updating containerd to a version built from a newer version of Go will always help as well as disabling plugins you don't need. Some of those plugins can also be configured with longer intervals, the defaults today are probably more assuming containers are actively be run and not necessarily tuned for mostly idle usage.

@catap
Copy link
Contributor

catap commented Feb 8, 2024

Here that I do have on my machine. 100% CPU usage on idle.

image

@catap
Copy link
Contributor

catap commented Feb 8, 2024

And I don't think that issue happening only on idle. I've started some container with some installing, and it still consumes CPU

image

@catap
Copy link
Contributor

catap commented Feb 8, 2024

Some gdb's bt which may help

Thread 6 "containerd" hit Breakpoint 1.2, 0x00007ffd8ad87a50 in clock_gettime ()
(gdb) bt
#0  0x00007ffd8ad87a50 in clock_gettime ()
#1  0x00005615302d9320 in time[now] ()
#2  0x000056153034082f in time[Now] ()
#3  0x00007f0ebebf07c8 in ?? ()
#4  0x000056153033e1af in time[sendTime] ()
#5  0x00007f0ebebf07c8 in ?? ()
#6  0x00005615302c07e6 in runtime.dodeltimer0 ()
#7  0x000000c0000d2f80 in ?? ()
#8  0x000000000000000b in ?? ()
#9  0x0000003e56e53175 in ?? ()
#10 0x0000000000000000 in ?? ()

and

Thread 2 "containerd" hit Breakpoint 1.2, 0x00007ffd8ad87a50 in clock_gettime ()
(gdb) bt
#0  0x00007ffd8ad87a50 in clock_gettime ()
#1  0x00005615302d8d0d in runtime.nanotime1.abi0 ()
#2  0x00005615302ad43a in runtime[sysmon] ()
#3  0x0000006b00002710 in ?? ()
#4  0x00007f0e00000002 in ?? ()
#5  0x00007f0ebefdc9d8 in ?? ()
#6  0x0100000000000000 in ?? ()
#7  0x0000000000002710 in ?? ()
#8  0x000000614d131813 in ?? ()
#9  0x00007f0ebefdc9f0 in ?? ()
#10 0x0000000000000000 in ?? ()

catap added a commit to catap/containerd that referenced this issue Feb 8, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Closes: containerd#5089
@baryluk
Copy link
Author

baryluk commented Feb 8, 2024

BTW. I reported this bug almost 3 years ago, but recently I had no issues on Debian testing. containerd is mostly idle and not using much CPU. 0.0-1.0% of one core. So it looks like it is still wakeing up a little periodically, despite no containers or user interactions. dockerd is running, but is idle.

Looking at strace, it is doing some non-blocking epoll_pwait, with zero timeout. Then it either tries to acquire some mutex with futex wait timeout (randomized around 6ms timeout), and also sometimes go to sleep for 10ms. So it still technically spins, and executes something 100 times per second.

Instead doing this, better approach would be to create eventfd, and add it to the epoll file set, then wait on everything with infinite timeout. the other threads can wakt that epoll using eventfd, I.e. when they release some mutex, or something (i do not know where that loop is or what it does exactly, but it looks like it participates in some cross-thread synchronization too).

catap added a commit to catap/containerd that referenced this issue Feb 8, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Closes: containerd#5089
catap added a commit to catap/containerd that referenced this issue Feb 8, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
@catap
Copy link
Contributor

catap commented Feb 8, 2024 via email

catap added a commit to catap/containerd that referenced this issue Feb 9, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Feb 9, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Feb 9, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Feb 10, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Feb 10, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Feb 15, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Feb 15, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Apr 22, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
catap added a commit to catap/containerd that referenced this issue Apr 22, 2024
On startup `gcTimeSum` might work fast and return `0`, so on this case
the algorithm turns in infinity loop which simple consume CPU on timer
which fires without any interval.

Use `5ms` as fallback to have interval `245ms` for that case.

Closes: containerd#5089

Signed-off-by: Kirill A. Korinsky <kirill@korins.ky>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants