Open btaczala opened 5 years ago
The problem is that mon != NULL
is assumed almost everywhere. If mon
(the focused monitor) is NULL
, it means that every monitor known to bspwm was removed…
So the question here is: what leads to mon == NULL
?
One thing worth mentioning is that this mostly happens when I undock the laptop from docking station, while in suspend. But I guess this is similar to unlogging the monitor as X output are still there just unplugged
I'm having the same problem. Did you ever find a solution to this?
I'm also having the same problem when I dock my laptop. The builtin display is turned --off
at the same time the external displays are enabled.
xrandr --output eDP1 --off \
--output DP2-1 --mode 3840x2160 --rate 30.00 --left-of DP2-2-8 --primary \
--output DP2-2-8 --mode 3840x2160 --rate 29.98
Core was generated by `bspwm'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000560b181f954a in focus_in (evt=<optimized out>) at src/events.c:351
351 src/events.c: No such file or directory.
(gdb) bt
#0 0x0000560b181f954a in focus_in (evt=<optimized out>) at src/events.c:351
#1 0x0000560b181ee4c9 in main (argc=1, argv=0x7ffe3df91d78) at src/bspwm.c:206
Which corresponds to the same spot in events.c: https://github.com/baskerville/bspwm/blob/2ffd9c140932c5be638f7d9cefd045e03f5f6f42/src/events.c#L351-L353
It seems like it doesn't occur that often (like almost never) if I set both remove_disabled_monitors
and remove_unplugged_monitors
to false before I suspend/hibernate my laptop.
wm_suspend() {
bspc config remove_disabled_monitors false
bspc config remove_unplugged_monitors false
systemctl suspend
}
To "adapt" to the new changes that can be to the monitor setup I've subscribed in my bspwm config with the following
bspc subscribe monitor | while read -r line; do
case $line in
monitor_add*|monitor_geometry*)
setup_desktops
#setup_panels
;;
monitor_remove*)
/usr/bin/autorandr --change
;;
*)
;;
esac
done &
also running into this issue, I think the window manager should be able to handle this correctly, what could be done in order to prevent this?
@baskerville bspwm is my favorite wm but this is keeping me from using it as I use a docking station and can't afford to be crashing my wm each time I decide to remove my laptop from it's dock, is there any work on this on the way? or maybe we could setup a "ghost" desktop to serve as fallback while there's no connected monitors
@deviantfero I've managed to get around this issue by using xrandr to "wake up" my laptop monitor, before it is suspended. The above "fix" I mentioned in the previous comment had somtimes some issues with the subscribe and I'm not using that anymore
My suspend function now looks like this
wm_suspend() {
ps -fC "bspwm" > /dev/null
if [ $? -eq 0 ]; then
bspc config remove_disabled_monitors false
bspc config remove_unplugged_monitors false
xrandr --output eDP-1 --auto
fi
#lock && systemctl suspend
lock && systemctl hybrid-sleep
}
And I'm still using autorandr with a postswitch/posthook script that then (re)applies my bspwm settings after I resume. I haven't experienced a crash for many months now.
My biggest problem is undocking my laptop, since I can't turn on my laptop monitor beforehand at least not in a script. docking is possible with those settings you've shared, but undocking still requires some manual intervention.
I don't think this is even related with suspending. Undocking when your laptop screen is disabled (off), will cause the same problem. How would you enable it before BSPWM crashes?
Maybe related. I am having an issue, that suspending from GDM works. But not from BSPWM. I use a dock, but I do not unplug any monitors.
However, I have got these: bspc config remove_disabled_monitors true bspc config remove_unplugged_monitors true
In my case, BSPWM does not crash. I couldn't find any errors. The screen is black but the backlight is active and the only way to gain control back is to restart my computer via the power button. (TTY shortcuts are not working)
But @KLIM8D's answer helped.
I don't think this is even related with suspending. Undocking when your laptop screen is disabled (off), will cause the same problem.
I can confirm this; it also includes monitors that have gone into power-save mode via (e.g.) dpms. This also affects the built-in monitor of laptops, which can also be turned off by dpms, so plugging in a dock or monitors while the screen is blanked causes bspwm to crash.
I haven't yet identified which combination of settings is involved (remove_disabled_monitors
, remove_unplugged_monitors
, or both), but it is certainly true that there are multiple situations where mon
will be null
This happens from time to time; when I put my laptop in suspend mode, unplug connected monitors and then wake laptop bspwm crashes. Backtrace:
The crash happens in
src/events.c
mon
is 0x0 in this expression hence the crash. The easy way to fix this is to change the line to:I can obviously fix this but perhaps this is a symptom of something bigger that should be fixed.
B