btop icon indicating copy to clipboard operation
btop copied to clipboard

[BUG] btop hangs after computer sleeps

Open IncPlusPlus opened this issue 1 year ago • 6 comments

Describe the bug

If I put my laptop to sleep for a few hours, btop will be frozen when I wake it. CTRL + C will not cause it to exit so I've been killing it from Activity Manager when freezes. This may not be a CPU-specific issue but for context, I'm on an Intel MacBook Pro.

I don't know much about MacBook sleep states but I do know that putting the laptop to sleep (not by just closing the lid, but by clicking  -> Sleep) will not actually put the machine into a sleep state for a certain amount of time. I know this anecdotally because if I put it to sleep, it will "wake" again if I merely touch the fingerprint sensor. However, if it has been "asleep" for several hours, I have to physically depress the fingerprint sensor (as it serves a dual-purpose as the power button) for the machine to wake. So, it seems there is a deeper sleep state that the machine will go into after an unknown (to me) amount of time. I believe that this deeper sleep state causes btop to hang.

To Reproduce

  1. Run btop on a Mac
  2. Put the Mac to sleep for several hours
  3. Wake the Mac
  4. See that btop has frozen

Expected behavior

  1. Run btop on a Mac
  2. Put the Mac to sleep for several hours
  3. Wake the Mac
  4. btop continues running without issue

Screenshots

When looking to see if this issue has been reported before, I came across #47 where btop was at 100% CPU utilization when it froze. The utilization in my case was reasonable. So, it's hanging for a different reason.

image (2)

Info (please complete the following information):

  • btop++ version: btop version: 1.2.13
  • Binary: Static binary installed via brew
  • Architecture: [x86_64, aarch64, etc.] x86_64
  • Platform: macOS
  • OS release version: Ventura 13.3.1
  • Terminal used: iTerm2
  • Font used: Monaco (the default for iTerm2)

Additional context

contents of ~/.config/btop/btop.log

2023/09/25 (11:17:36) | ===> btop++ v.1.2.13
2023/09/25 (11:17:36) | DEBUG: Starting in DEBUG mode!
2023/09/25 (11:17:36) | INFO: Logger set to DEBUG
2023/09/25 (11:17:36) | DEBUG: Using locale en_US.UTF-8
2023/09/25 (11:17:36) | INFO: Running on /dev/ttys007
2023/09/25 (11:17:36) | DEBUG: get_sensors(): show_coretemp=1 check_temp=1
2023/09/25 (11:17:36) | DEBUG: checking intel
2023/09/25 (11:17:36) | DEBUG: intel sensors found
2023/09/25 (11:17:36) | DEBUG: intel sensors with offset 1
2023/09/25 (19:18:26) | ERROR: Stall in Runner thread, restarting!
2023/09/25 (20:46:47) | ERROR: Stall in Runner thread, restarting!
2023/09/25 (20:47:27) | ERROR: Stall in Runner thread, restarting!
2023/09/25 (23:50:35) | ERROR: Stall in Runner thread, restarting!
2023/09/25 (23:50:42) | ERROR: Stall in Runner thread, restarting!
2023/09/25 (23:50:48) | ERROR: Stall in Runner thread, restarting!
2023/09/25 (23:50:56) | ERROR: Stall in Runner thread, restarting!
2023/09/25 (23:51:03) | ERROR: Stall in Runner thread, restarting!
2023/09/26 (00:09:19) | ERROR: Stall in Runner thread, restarting!
2023/09/26 (00:09:37) | ERROR: Stall in Runner thread, restarting!
2023/09/26 (00:09:44) | ERROR: Stall in Runner thread, restarting!
2023/09/26 (00:09:58) | ERROR: Stall in Runner thread, restarting!
2023/09/26 (07:19:49) | ERROR: Stall in Runner thread, restarting!
2023/09/26 (09:00:52) | ERROR: Stall in Runner thread, restarting!

No additional lines are written to the log after btop hangs.

GDB Backtrace

I tried running lldb btop but it won't run properly:

➜  ~ lldb btop
(lldb) target create "btop"
Current executable set to 'btop' (x86_64).
(lldb) r
Process 19971 launched: '/usr/local/bin/btop' (x86_64)
ERROR: Failed to get size of terminal!
Process 19971 exited with status = 1 (0x00000001)

IncPlusPlus avatar Sep 28 '23 16:09 IncPlusPlus

Not sure if this might help but after I kill the frozen btop process with Activity Monitor, if I click anywhere in my terminal I hear the bell sound and a series of characters is printed as seen in this screenshot. This continues until I use CTRL + C which finally gives me control over the terminal again. The characters seem to change based on where I click so I'm guessing this is just the part of btop UI that determines where clicks occurred.

image

IncPlusPlus avatar Oct 04 '23 14:10 IncPlusPlus

I have similar on M1 mini under Sonoma. As I recall app had crashed/been terminated but the screen needed RESET to clear, before that everything I did just resulted in a short ESC sequence. It happened twice but I have avoided leaving it running now... I cold do more testing if that would help - but can't find any crash dump from before. Maybe looking in wrong place as only just moved to Apple silicon and Sonoma...

cw1nte avatar Dec 29 '23 09:12 cw1nte

For me it was old [defunct] processes. Beep on every refresh until I invoked kill -9 on them and restarted btop.

tidux avatar Jan 28 '24 22:01 tidux

If freezes for me as well, version 1.3.2 on Linux 5.14/x86_64, except that keyboards interrupts work so I can kill it directly from the terminal.

sionescu avatar Feb 28 '24 14:02 sionescu

Freezes in both my macs: intel and apple silicon, with latest & updated OS versions. Installed by Homebrew. Version 1.3.2.

AlexEscalante avatar Mar 12 '24 00:03 AlexEscalante