Robustness improvement suggestion
Describe the bug Crash of redshift-gtk on some platforms related to the use of (or rather lack thereof) graphical-session.target
- [x] I have checked the FAQ, my issue is indeed mentioned there, and the relevant issue is described in depth in #265 however I do believe the code might be improved in order to avoid the crash.
To reproduce Steps to reproduce the behavior:
- Install redshift-gtk Debian package
- Wait for reboot
- Notice the crash in syslogs (
journalctl --user -u redshift-gtk)
Expected behavior I expect redshift-gtk to execute without a crash.
Error output/logs/screenshots No screenshot but here is the backtrace of the core dump
#0 0x00007f6e58f91690 in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#1 0x00007f6e58e322c4 in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#2 0x00007f6e58e53ad8 in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#3 0x00007f6e58e3e21a in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#4 0x00007f6e58e539a8 in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#5 0x00007f6e58e3eb62 in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#6 0x00007f6e5ac99357 in g_type_create_instance () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#7 0x00007f6e5ac7f615 in () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#8 0x00007f6e5ac80b1d in g_object_new_with_properties () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#9 0x00007f6e5ac815f1 in g_object_new () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007f6e58e5c47b in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#11 0x00007f6e59045819 in () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#12 0x00007f6e5ac99357 in g_type_create_instance () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#13 0x00007f6e5ac7f615 in () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#14 0x00007f6e5ac80b1d in g_object_new_with_properties () at /lib/x86_64-linux-gnu/libgobject-2.0.so.0
#15 0x00007f6e5ae2ce84 in () at /usr/lib/python3/dist-packages/gi/_gi.cpython-39-x86_64-linux-gnu.so
#16 0x00007f6e5ae4ad4f in () at /usr/lib/python3/dist-packages/gi/_gi.cpython-39-x86_64-linux-gnu.so
#17 0x000000000051d6f5 in _PyObject_MakeTpCall ()
#18 0x00000000005175ba in _PyEval_EvalFrameDefault ()
#19 0x0000000000528b63 in _PyFunction_Vectorcall ()
#20 0x0000000000537b80 in ()
#21 0x000000000051d6f5 in _PyObject_MakeTpCall ()
#22 0x00000000005170e4 in _PyEval_EvalFrameDefault ()
#23 0x0000000000510fe7 in ()
#24 0x0000000000528d21 in _PyFunction_Vectorcall ()
#25 0x0000000000511fb5 in _PyEval_EvalFrameDefault ()
#26 0x00000000005106ed in ()
#27 0x0000000000510497 in _PyEval_EvalCodeWithName ()
#28 0x00000000005f5be3 in PyEval_EvalCode ()
#29 0x0000000000619de7 in ()
#30 0x0000000000615610 in ()
#31 0x0000000000619d79 in ()
#32 0x0000000000619816 in PyRun_SimpleFileExFlags ()
#33 0x000000000060d4e3 in Py_RunMain ()
#34 0x00000000005ea6e9 in Py_BytesMain ()
#35 0x00007f6e5b542d0a in __libc_start_main (main=0x5ea6b0, argc=2, argv=0x7fff17c021a8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff17c02198) at ../csu/libc-start.c:308
#36 0x00000000005ea5ea in _start ()
Software versions (please complete the following information):
- OS: GNU/Linux
- Redshift version: 1.12
- Distribution: Debian (it might affect other distributions)
- Redshift installed from: using apt-get
Remarks
Provided the issue is caused by an empty DISPLAY environment variable, I believe the crash could be avoided simply by looking at environment variables e.g. using Python equivalent to envp i.e. os.environ['DISPLAY'] and if that makes sense gracefully exit on the event « no DISPLAY variable defined »
Moreover as a small improvement a delay could be introduced in systemd service definition file between restart attempts (using RestartSec= field, as per systemd.service(5)), in order to avoid a frenzy restart and give time to the boot process to reach a step when DISPLAY is defined.