btop icon indicating copy to clipboard operation
btop copied to clipboard

[BUG] btop hangs after some time of high cpu usage

Open Lyapsus opened this issue 10 months ago • 1 comments

Describe the bug

Well title is quite enough of description - after some time of high cpu usage btop slows and eventually hangs, sometimes even unresponsive to Ctrl+C. Sometimes it crashes instead.

To Reproduce

1. run btop in one Konsole tab
2. run something like "paru -S llama.cpp-cublas-git" in another tab, make sure building uses all cpu cores

Expected behavior

btop doesn't hang in high cpu usage scenario

Info

  • btop++ version: 1.3.2 cachyos-extra-v3/btop
  • Binary: [self compiled or static binary from release]
  • Architecture: x86_64
  • Platform: Linux
  • (Linux) Kernel: 6.8.1-arch1-1
  • Terminal used: cachyos-extra-v3/konsole

Additional context

2024/04/17 (15:38:19) | ===> btop++ v.1.3.2
2024/04/17 (15:38:19) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:39:36) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:39:50) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:46:00) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:46:31) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:46:54) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:47:06) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:47:27) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:48:30) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:49:13) | ERROR: Stall in Runner thread, restarting!
2024/04/17 (15:49:23) | ERROR: Stall in Runner thread, restarting!
2024/04/16 (23:07:24) | ===> btop++ v.1.3.2
...
2024/04/16 (23:49:23) | WARNING: Error in Mem::collect() : std::future_error: No associated state
2024/04/16 (23:49:27) | WARNING: Error in Mem::collect() : std::future_error: No associated state
2024/04/16 (23:49:29) | ERROR: Stall in Runner thread, restarting!
2024/04/16 (23:49:29) | WARNING: Error in Mem::collect() : std::future_error: No associated state
2024/04/16 (23:49:38) | WARNING: Error in Mem::collect() : std::future_error: No associated state
2024/04/16 (23:49:43) | ERROR: Stall in Runner thread, restarting!
...

Lyapsus avatar Apr 17 '24 13:04 Lyapsus

I've also just had btop hang in a high-cpu situation.

It's running, there are three processes, and strace says:

$ sudo strace -fp 1096961

[pid 1096961] futex(0x7fd7d9ea3910, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 1097857, {tv_sec=5, tv_nsec=140565086823507}, FUTEX_BITSET_MATCH_ANY) = -1 EINVAL (Invalid argument)
[pid 1096961] futex(0x7fd7d9ea3910, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 1097857, {tv_sec=5, tv_nsec=140565086823507}, FUTEX_BITSET_MATCH_ANY) = -1 EINVAL (Invalid argument)
[pid 1096961] futex(0x7fd7d9ea3910, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 1097857, {tv_sec=5, tv_nsec=140565086823507}, FUTEX_BITSET_MATCH_ANY) = -1 EINVAL (Invalid argument)
[pid 1096961] futex(0x7fd7d9ea3910, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 1097857, {tv_sec=5, tv_nsec=140565086823507}, FUTEX_BITSET_MATCH_ANY) = -1 EINVAL (Invalid argument)
[pid 1096961] futex(0x7fd7d9ea3910, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 1097857, {tv_sec=5, tv_nsec=140565086823507}, FUTEX_BITSET_MATCH_ANY) = -1 EINVAL (Invalid argument)
[pid 1096961] futex(0x7fd7d9ea3910, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 1097857, {tv_sec=5, tv_nsec=140565086823507}, FUTEX_BITSET_MATCH_ANY) = -1 EINVAL (Invalid argument)
^C) = -1 EINVAL (Invalid argument)
strace: Process 1096961 detached
strace: Process 1096963 detached
strace: Process 1097857 detached

The futex() calls are streaming by as fast as possible, all on the main process of the three.

The second process is just waiting for input:

# strace -p 1096963
 
strace: Process 1096963 attached
read(0, ^Cstrace: Process 1096963 detached
 <detached ...>

The third process is waiting on a futex:

# strace -p 1097857

strace: Process 1097857 attached
futex(0x557b550eab64, FUTEX_WAIT, 0, NULL^Cstrace: Process 1097857 detached
 <detached ...>

PenelopeFudd avatar Sep 15 '24 04:09 PenelopeFudd