bspwm icon indicating copy to clipboard operation
bspwm copied to clipboard

Freezes

Open D3SK3R opened this issue 2 years ago • 16 comments

It looks like #683 I have been trying to figure out what's happening for some time now, looking at that post, I saw the command "bspc subscribe --fifo". It's been freezing randomly for weeks now almost every day, but it reliably freezes when I run that command, and it unfreezes when I cat or tail the file it points me too (/run/user/1000/bspwm_fifo.). Because of this behavior, I believe it's not something external, but a bspwm thing.

D3SK3R avatar Jul 08 '22 19:07 D3SK3R

See #1318. Do you also use polybar with the player-mpris-tail module?

zjeffer avatar Jul 08 '22 20:07 zjeffer

See #1318. Do you also use polybar with the player-mpris-tail module?

forgot to mention that issue, no I don't use this module, and during one freeze I killed polybar to see if that was the case, but no

D3SK3R avatar Jul 09 '22 05:07 D3SK3R

Do bspc commands also never execute when it's frozen? If you open something like htop, are bspc processes piling up?

zjeffer avatar Jul 10 '22 16:07 zjeffer

Do bspc commands also never execute when it's frozen? If you open something like htop, are bspc processes piling up?

not sure what you mean by piling up, but when I try to execute a bspc command, it just never responds

D3SK3R avatar Jul 10 '22 17:07 D3SK3R

Yeah that's what I mean: in my case, focus-follows-pointer is enabled, meaning it will execute a bspc command every time I move my cursor over another window (to put that new window in focus). Every one of those commands never respond, resulting in a big list of bspc commands never getting executed. This list of processes is easy to see in htop, that's what I mean by piling up.

zjeffer avatar Jul 10 '22 17:07 zjeffer

Yeah that's what I mean: in my case, focus-follows-pointer is enabled, meaning it will execute a bspc command every time I move my cursor over another window (to put that new window in focus). Every one of those commands never respond, resulting in a big list of bspc commands never getting executed. This list of processes is easy to see in htop, that's what I mean by piling up.

ye it just happened again, and running ps aux | grep bspc from the tty, it shows way too many bspc commands

I just spent 30 minutes inside the tty trying stuff to unfreeze bspwm, killing basically all processes one by one to see if I find a faulty one, but nothing, it's getting more and more frustrating

D3SK3R avatar Jul 10 '22 20:07 D3SK3R

It's strange because I had the same issue last year almost every day, but I haven't experienced the problem for months now.

What does lsof -p$(pgrep -x bspwm) output? Try the command once it freezes, and compare it to the output when it's running normally.

zjeffer avatar Jul 16 '22 16:07 zjeffer

It's strange because I had the same issue last year almost every day, but I haven't experienced the problem for months now.

What does lsof -p$(pgrep -x bspwm) output? Try the command once it freezes, and compare it to the output when it's running normally.

It stopped here too, no idea why is it, but for the last 5 days, I haven't experienced a freeze, while it used to happen every day, and NOTHING changed on my system

D3SK3R avatar Jul 16 '22 16:07 D3SK3R

It's strange because I had the same issue last year almost every day, but I haven't experienced the problem for months now.

What does lsof -p$(pgrep -x bspwm) output? Try the command once it freezes, and compare it to the output when it's running normally.

well well, It just happened again, one more freaking freeze. And the output to that command looked exactly like when it's working normally

D3SK3R avatar Jul 17 '22 06:07 D3SK3R

Seems like I've just faced this freeze myself. But thanks I looked at this issue earlier, I knew what to look for. My "uptime" was several days though.

So it's interesting.. In my case it seems it was triggered by a new state of the script module (once I got a new notification on GitHub):

#!/bin/sh

if [ x"$1" == x"corp" ]; then
  location_url="https://corp.domain.tld/api/v3/notifications"
  access_token=`cat ~/.config/github/polybar.corp.token`
else
  location_url="https://api.github.com/notifications"
  access_token=`cat ~/.config/github/polybar.token`
fi

page=1
count=0

while [ $page -gt 0 ]; do
  count_p=$count
  count_c=$(curl -s -m 10 --retry 3 -H "Authorization: token ${access_token}" "${location_url}?page=${page}" | jq -r 'if length == 0 then 0 else [.[] | select(.unread == true)] | length end' 2> /dev/null)

  if [ -z "$count_c" ]; then
    echo "N/A"

    break
  fi

  let count=count+count_c

  if [ $count_p -eq $count ]; then
    page=0

    if [ $count -eq 0 ]; then
      echo "$count"
    else
      if [ x"$1" == x"corp" ]; then
        color="#bd2c40"
      else
        color="#55aa55"
      fi

      echo "%{F${color}}$count%{F-}"
    fi
  else
    let page++
  fi
done

but, similarly to #1318, killing polybar didn't help, and what did was killing this script still running from another polybar script module:

#!/bin/sh

STATE="$(dirname $0)/.nd.state"

state() {
  if [ ! -f "${STATE}" ]; then
    echo "%{F#555}%{F-} active"
  else
    echo "%{F#bd2c40}%{F-} paused"
  fi
}

toggle() {
  if [ -f "${STATE}" ]; then
    pkill -USR2 -x dunst && rm "${STATE}" && notify-send "...dunst resumed"
  else
    notify-send -t 1000 "pausing dunst..." && sleep 1 && pkill -USR1 -x dunst && touch "${STATE}"
  fi

  exit 0
}

trap "toggle" USR1

while :; do
  state
  sleep 1 &
  wait
done

I wonder if @patrick96 has any ideas on what might be the cause and how to debug this better.

vaygr avatar Jul 17 '22 22:07 vaygr

cc @baskerville @emanuele6

vaygr avatar Jul 18 '22 00:07 vaygr

Well... It happened again. Just bought a new laptop, installed Arco Linux, then bspwm, started setting everything up and then freeze... But this time I could reproduce the freeze by running update-grub, everytime I run it, the window manager freezes, but it's not limited to it, some times it freezes out of nowhere, like before... I have bspwm and kde installed, this grub freeze only happens on bspwm, I can run update-grub, grub customizer, and everything works fine under kde. (The freezes start by making my unable control the window manager, my mouse stops focusing new windows, I cant spawn or kill any window, but can still move my mouse and type into the window that was focused before the freeze, I can even spawn windows that's not managed, like rofi, but after like 30 seconds, it completely freezes, I can't even move the mouse or enter a tty)

D3SK3R avatar Aug 17 '22 19:08 D3SK3R

@D3SK3R Can you include some logs?

zjeffer avatar Aug 17 '22 19:08 zjeffer

@D3SK3R Can you include some logs?

After some hours of trying different stuff, I found out that the problem was actually the nvidia driver, using the normal 'nvidia', it would freeze every time I tried to change something in grub, it stopped happening when I changed to nvidia-dkms. So we are back to the old freezes, bspwm still freezes out of nowhere, apparently randomly.

D3SK3R avatar Aug 17 '22 23:08 D3SK3R