Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

CPU usage 100% after clicking on a status bar

Open MaxVerevkin opened this issue 2 years ago • 3 comments

This does not happen with other compositors (river). After I click a few times on i3bar-river Hyprland's CPU usage goes to 100%. Restarting status bar fixes it. Status bar's CPU usage is normal.

sudo trace -p $(pgrep Hyprland) is filled with

   981.370 ( 0.017 ms): Hyprland/360133 epoll_wait(epfd: 3<anon_inode:[eventpoll]>, events: 0x7ffd6f0fc810, maxevents: 32, timeout: 4294967295) = 1
LOST 33 events!
   981.370 ( 0.029 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 35 events!
   981.370 ( 0.042 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 37 events!
   981.370 ( 0.056 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 37 events!
   981.370 ( 0.069 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 27 events!
   981.370 ( 0.079 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 35 events!
   981.370 ( 0.092 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 33 events!
   981.370 ( 0.105 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 43 events!
   981.370 ( 0.121 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 22 events!
   981.492 ( 0.009 ms): Hyprland/360133 epoll_wait(epfd: 3<anon_inode:[eventpoll]>, events: 0x7ffd6f0fc810, maxevents: 32, timeout: 4294967295) = 1
LOST 41 events!
   981.492 ( 0.025 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 33 events!
   981.492 ( 0.037 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 36 events!
   981.531 ( 0.014 ms): Hyprland/360133 epoll_wait(epfd: 3<anon_inode:[eventpoll]>, events: 0x7ffd6f0fc810, maxevents: 32, timeout: 4294967295) = 1
LOST 37 events!
   981.531 ( 0.028 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 37 events!
   981.531 ( 0.040 ms): Hyprland/360133  ... [continued]: epoll_wait())                                       = 1
LOST 24 events!
   981.572 ( 0.010 ms): Hyprland/360133 epoll_wait(epfd: 3<anon_inode:[eventpoll]>, events: 0x7ffd6f0fc810, maxevents: 32, timeout: 4294967295) = 1
LOST 29 events!

Log: https://pastebin.com/AsJdveL5

MaxVerevkin avatar Feb 04 '23 09:02 MaxVerevkin

unable to repro..? Maybe I need a specific config?

vaxerski avatar Feb 05 '23 22:02 vaxerski

Not as minimal of a config as I hoped to get, but

i3bar-river https://github.com/MaxVerevkin/i3bar-river/commit/77c8cf67536f7d7d8e20829c5be1d4bf59a4c0d3

i3status-rs https://github.com/greshake/i3status-rust/commit/a790604829fdd5f331c012f1d88090e46879705f

# ~/.config/i3bar-river/config.toml
font = "monospace 10"
command = "i3status-rs"
# ~/.config/i3status-rust/config.toml

# Without this block the issue goes away
[[block]]
block = "custom"
command = "hyprland-kbd-layout.sh"
persistent = true

# This block is here to see how CPU usage increases
[[block]]
block = "cpu"
interval = 1
format = " $icon $utilization "
#!/bin/sh

# this is 'hyprland-kbd-layout.sh'

function handle {
  prefix="activelayout>>at-translated-set-2-keyboard"
  if [[ ${1:0:42} == $prefix ]]; then
    layout="${1#"$prefix,"}"
    case $layout in
    "Russian")
        echo ru
    ;;
    "English")
        echo en
    ;;
    *)
        echo $layout
    esac
  fi
}

echo 'en'

socat - UNIX-CONNECT:/tmp/hypr/$(echo $HYPRLAND_INSTANCE_SIGNATURE)/.socket2.sock | while read line; do handle $line; done

MaxVerevkin avatar Feb 06 '23 10:02 MaxVerevkin

To reproduce click either block a few times

MaxVerevkin avatar Feb 06 '23 10:02 MaxVerevkin

Can't reproduce it anymore, probably fixed by e4e653ada6fc729efad3f6a0d49cf72b94c43b6c. Closing.

MaxVerevkin avatar Apr 09 '23 19:04 MaxVerevkin

Apparently, this was partly a i3status-rs bug, as it didn't set child's stdin to null.

MaxVerevkin avatar Apr 10 '23 18:04 MaxVerevkin