! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Crash on monitor changes
Status:
RESOLVED: FIXED
Product:
Xfdesktop
Component:
General

Comments

Description Paul Menzel 2018-08-17 15:04:27 CEST
Created attachment 7886 
Full backtrace acquired with `bt f` in GDB

With Xfdesktop 4.13.2, turning the tiled/MST monitor Dell UP3214Q off and back on, there is the segmentation fault below.

#0  0x00007f3c8e734677 in g_type_check_instance_is_fundamentally_a (type_instance=type_instance@entry=0x69506b6447203a29, fundamental_type=fundamental_type@entry=80)
    at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gobject/gtype.c:4023
4023	/scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gobject/gtype.c: No such file or directory.

(gdb) bt
#0  0x00007f3c8e734677 in g_type_check_instance_is_fundamentally_a (type_instance=type_instance@entry=0x69506b6447203a29, fundamental_type=fundamental_type@entry=80) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gobject/gtype.c:4023
#1  0x00007f3c8e713e4e in g_object_ref (_object=_object@entry=0x69506b6447203a29) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gobject/gobject.c:3206
#2  0x00007f3c8f79c848 in g_task_new (source_object=source_object@entry=0x952b90, cancellable=cancellable@entry=0x69506b6447203a29, callback=callback@entry=0x7f3c8f774b70 <async_ready_callback_wrapper>, callback_data=callback_data@entry=0x73dd10) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gio/gtask.c:698
#3  0x00007f3c8f774e0f in g_input_stream_real_read_async (stream=0x952b90 [GLocalFileInputStream], buffer=0x2d66756278, count=32768, io_priority=300, cancellable=0x69506b6447203a29, callback=0x7f3c8f774b70 <async_ready_callback_wrapper>, user_data=0x73dd10) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gio/ginputstream.c:1383
#4  0x00007f3c8f773f52 in g_input_stream_read_async (stream=stream@entry=0x952b90 [GLocalFileInputStream], buffer=0x2d66756278, count=count@entry=32768, io_priority=io_priority@entry=300, cancellable=0x69506b6447203a29, callback=callback@entry=0x421650 <xfce_backdrop_file_input_stream_ready_cb>, user_data=0x73dd10) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gio/ginputstream.c:633
#5  0x00000000004216ed in xfce_backdrop_file_input_stream_ready_cb (source_object=0x952b90 [GLocalFileInputStream], res=0x6ffbb0, user_data=0x73dd10) at /scratch/local/bee-root/xfdesktop/xfdesktop-4.13.2-0/source/src/xfce-backdrop.c:2013
#6  0x00007f3c8f774b9a in async_ready_callback_wrapper (source_object=0x952b90 [GLocalFileInputStream], res=0x6ffbb0, user_data=0x73dd10) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gio/ginputstream.c:532
#7  0x00007f3c8f79c4c3 in g_task_return_now (task=0x6ffbb0 [GTask]) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gio/gtask.c:1148
#8  0x00007f3c8f79c4f9 in complete_in_idle_cb (task=0x6ffbb0) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gio/gtask.c:1162
#9  0x00007f3c8e435705 in g_main_dispatch (context=0x684510) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:3177
#10 0x00007f3c8e435705 in g_main_context_dispatch (context=context@entry=0x684510) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:3830
#11 0x00007f3c8e435aa8 in g_main_context_iterate (context=0x684510, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:3903
#12 0x00007f3c8e435db2 in g_main_loop_run (loop=0xa17c40) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:4099
#13 0x00007f3c901e8655 in gtk_main () at /dev/shm/bee-pmenzel/gtk3/gtk3-3.22.30-1/source/gtk/gtkmain.c:1323
#14 0x000000000042949c in xfdesktop_application_start (app=0x680150 [XfdesktopApplication]) at /scratch/local/bee-root/xfdesktop/xfdesktop-4.13.2-0/source/src/xfdesktop-application.c:764
#15 0x0000000000429690 in cb_wait_for_window_manager_destroyed (data=0x6f74f0) at /scratch/local/bee-root/xfdesktop/xfdesktop-4.13.2-0/source/src/xfdesktop-application.c:587
#16 0x00007f3c8e432293 in g_source_callback_unref (cb_data=0x7f3c780086f0) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:1546
#17 0x00007f3c8e432ccc in g_source_destroy_internal (source=0x712610, context=0x684510, have_lock=1) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:1236
#18 0x00007f3c8e435790 in g_main_dispatch (context=0x684510) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:3201
#19 0x00007f3c8e435790 in g_main_context_dispatch (context=context@entry=0x684510) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:3830
#20 0x00007f3c8e435aa8 in g_main_context_iterate (context=context@entry=0x684510, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:3903
#21 0x00007f3c8e435b2c in g_main_context_iteration (context=context@entry=0x684510, may_block=may_block@entry=1) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/glib/gmain.c:3964
#22 0x00007f3c8f7b198d in g_application_run (application=0x680150 [XfdesktopApplication], argc=argc@entry=5, argv=argv@entry=0x7ffcc03965d8) at /scratch/local/bee-root/glib2/glib2-2.56.1-0/source/gio/gapplication.c:2470
#23 0x000000000042a5bd in xfdesktop_application_run (app=app@entry=0x680150 [XfdesktopApplication], argc=argc@entry=5, argv=argv@entry=0x7ffcc03965d8) at /scratch/local/bee-root/xfdesktop/xfdesktop-4.13.2-0/source/src/xfdesktop-application.c:773
#24 0x000000000041a242 in main (argc=5, argv=0x7ffcc03965d8) at /scratch/local/bee-root/xfdesktop/xfdesktop-4.13.2-0/source/src/main.c:58
Comment 1 Andre Miranda editbugs 2018-08-24 05:10:52 CEST
I noticed this bug a while ago, xfdesktop crashes when I close/open my laptop lid.
It segfaults at https://git.xfce.org/xfce/xfdesktop/tree/src/xfce-backdrop.c?id=49a527bc928d776e497ee45e0a458e97bf8e234c#n2012 something fishy is passed to gdk_pixbuf_loader_write then gdk_pixbuf chokes.
Needs further investigation...
Comment 2 Andre Miranda editbugs 2018-10-19 03:16:30 CEST
*** Bug 14002 has been marked as a duplicate of this bug. ***
Comment 3 Andre Miranda editbugs 2018-12-01 04:14:45 CET
*** Bug 14927 has been marked as a duplicate of this bug. ***
Comment 4 Andre Miranda editbugs 2018-12-28 04:00:47 CET
Created attachment 8203 
possible-fix.patch

The attached patch stops the crashes for me (on lid close), Paul can you give it a try?

Explanation:
Pixbufs for backdrops are loaded asynchronously, for some reason when the signal "size-prepared"is fired the backdrop may be still invalid, but later another signal will be fired and it will be valid, but it now it's too late because on first try the data has been released. This patch skips data clean-up  on cases the backdrop is invalid. I also included a couple of prints just to be check if it behaves as expected (invalid -> valid -> unref).

I'm just not sure if this is a proper fix, maybe the moment that signal is fired changed between gtk2/gtk3, no idea.
Another interesting thing I found is that the backdrop is reloaded when I close the lid, that happens due a callback to GdkScreen's "monitors-changed" signal, which is fired twice :/
Comment 5 Martin Mokrejš 2018-12-30 12:51:09 CET
Hi Andre,
   I applied the patch to xfdesktop-4.13.2 on my Gentoo Linux. After a brief testing I have indeed no new core dumps in my /var/dumps/, great. I realized that if I use Fn+F1 to use only my external HDMI display and to turn off the laptop's internal LCD, after lid open my laptop has again enabled LCD screen and using the size of the external HDMI display (1920x1200 instead of its own max 1366x768). I do not recall seeing this before. Could this be caused by your patch?

$ dmesg
[  746.362842] [7102]: Lid closed.
[  754.655963] [7102]: Lid opened.
[  765.975115] [7102]: Lid closed.
[ 1256.930836] [7102]: Lid opened.
[ 4909.671002] [7102]: Lid closed.
[ 4914.565392] [7102]: Lid opened.
[ 4940.668204] [7102]: Lid closed.
[ 4948.342004] [7102]: Lid opened.
$

Maybe some checksum could be logged too so one could better discern when the event triggered and to better match it so .xsession-errors file contents? In the below log the messages around "Negative content width -1" were supposedly caused by libreoffice which remembers position o the window from a last execution and placed the window on my laptop indeed somewhere above the left upper corner. I assume that is because it remembered position from my 1920x1200 external HDMI screen while at the moment I was using laptop's internal 1366x768 screen. As there is no "Move window" place around the window luckily the only way to get to the menu of the window is to use "Maximize window" from the Xfce panel.

Anyway, the logged events you added in the patch should bear a timestamp (see below).

$ cat ~/.xsession-errors
/usr/bin/startxfce4: X server already running on display :0
gpg-agent[7061]: WARNING: "--write-env-file" is an obsolete option - it has no effect
gpg-agent[7062]: gpg-agent (GnuPG) 2.2.12 started

(xfce4-session:7009): xfce4-session-WARNING **: 11:12:38.070: gpg-agent returned no PID in the variables

(xfsettingsd:7085): xfsettingsd-WARNING **: 11:12:40.634: Property "/Gdk/WindowScalingFactor" has an unsupported type "guint".

** (xfdesktop:7089): WARNING **: 11:12:41.636: Thumbnailer failed calling GetFlavors

(xfsettingsd:7085): xfsettingsd-CRITICAL **: 11:12:42.185: Stored Xfconf properties disable all outputs, aborting.
Warning:          Unsupported high keycode 372 for name <I372> ignored
                  X11 cannot support keycodes above 255.
                  This warning only shows for the first high keycode.
GNOME_KEYRING_CONTROL=/home/mmokrejs/.cache/keyring-SJ6YUZ
SSH_AUTH_SOCK=/home/mmokrejs/.cache/keyring-SJ6YUZ/ssh
Warning:          Unsupported high keycode 372 for name <I372> ignored
                  X11 cannot support keycodes above 255.
                  This warning only shows for the first high keycode.
Warning:          Unsupported high keycode 372 for name <I372> ignored
                  X11 cannot support keycodes above 255.
                  This warning only shows for the first high keycode.

(wrapper-2.0:7146): Gtk-WARNING **: 11:12:44.220: gtk_widget_size_allocate(): attempt to allocate widget with width -3 and height 26

(wrapper-2.0:7147): Gtk-WARNING **: 11:12:44.222: gtk_widget_size_allocate(): attempt to allocate widget with width -1 and height 28

(wrapper-2.0:7147): Gtk-WARNING **: 11:12:44.222: Negative content width -1 (allocation 1, extents 1x1) while allocating gadget (node border, owner GtkFrame)

(wrapper-2.0:7141): Gtk-WARNING **: 11:12:44.242: Negative content width -1 (allocation 1, extents 1x1) while allocating gadget (node button, owner GtkButton)
VALID BACKDROP!

(wrapper-2.0:7151): Gtk-WARNING **: 11:12:45.183: Negative content width -1 (allocation 1, extents 1x1) while allocating gadget (node button, owner XfceArrowButton)
UNREF LOADER
VALID BACKDROP!
VALID BACKDROP!
UNREF LOADER
UNREF LOADER
VALID BACKDROP!
UNREF LOADER
INVALID BACKDROP!
VALID BACKDROP!
UNREF LOADER
VALID BACKDROP!
UNREF LOADER

(xfsettingsd:7085): xfsettingsd-CRITICAL **: 12:31:29.052: Failed to apply display settings

(xfwm4:7063): xfwm4-WARNING **: 12:31:29.055: output size (1920x1200) and logical screen size (1366x768) do not match

(xfwm4:7063): xfwm4-WARNING **: 12:31:29.056: output size (1920x1200) and logical screen size (1366x768) do not match
UNREF LOADER
UNREF LOADER
UNREF LOADER
VALID BACKDROP!
UNREF LOADER
UNREF LOADER

(xfsettingsd:7085): xfsettingsd-CRITICAL **: 12:31:54.788: Failed to apply display settings
UNREF LOADER
UNREF LOADER

(xfsettingsd:7085): xfsettingsd-CRITICAL **: 12:32:28.566: Failed to apply display settings
UNREF LOADER

(xfwm4:7063): xfwm4-WARNING **: 12:32:58.572: output size (1366x768) and logical screen size (1920x1200) do not match

(xfwm4:7063): xfwm4-WARNING **: 12:32:58.576: output size (1366x768) and logical screen size (1920x1200) do not match
UNREF LOADER
VALID BACKDROP!
UNREF LOADER
$
Comment 6 Martin Mokrejš 2018-12-30 12:53:19 CET
BTW, this would be maybe more helpful:

$ dmesg |  grep 7102
[  160.994295] [7102]: New seat seat0.
[  160.995762] [7102]: Watching system buttons on /dev/input/event3 (Power Button)
[  161.037199] [7102]: Watching system buttons on /dev/input/event1 (Power Button)
[  161.040300] [7102]: Watching system buttons on /dev/input/event0 (Lid Switch)
[  161.040414] [7102]: Watching system buttons on /dev/input/event2 (Sleep Button)
[  161.347041] [7102]: Watching system buttons on /dev/input/event5 (AT Translated Set 2 keyboard)
[  746.362842] [7102]: Lid closed.
[  754.655963] [7102]: Lid opened.
[  765.975115] [7102]: Lid closed.
[ 1256.930836] [7102]: Lid opened.
[ 4909.671002] [7102]: Lid closed.
[ 4914.565392] [7102]: Lid opened.
[ 4940.668204] [7102]: Lid closed.
[ 4948.342004] [7102]: Lid opened.
$

Why not logging in a UNIX process name instead of its PID?
Comment 7 Martin Mokrejš 2018-12-30 13:05:09 CET
When I have only external HDMI enabled and close my laptop and turn off the external HDMI screen, upon lid open I get:

(xfsettingsd:7085): xfsettingsd-CRITICAL **: 12:58:04.247: Failed to apply display settings
UNREF LOADER

(note only one UNREF LOADER message).


Then after turning on the external HDMI and Fn+F1 to use only external HDMI screen I get the second:

UNREF LOADER

line into the .xsession-errors file. Supposedly because the laptops internal LCD was just turned off (anyway, it had the wrong size 1920x1200 since the lid open).

The message " Failed to apply display settings" should be clearer and mention which display it was looking for.
Comment 8 Martin Mokrejš 2018-12-30 14:49:52 CET
Hi,
  sorry to bug you again. I let the laptop with external HDMI enabled and internal LCD disabled. After a while external HDMI felt asleep into stand-by mode. But, I could not wake up a screen when touching my keyboard. Not even ctrl+alt+f1 helped (which usually brings me into framebuffer console out off the X11 windows and hence wakes up my screen). Alt+SysRq+S seemed to trigger some disk activity at least. The trick which worked was to close the lid and open again. That at least woke up the internal LCD of the laptop. Although it so far feels like a bug in this case it was better than nothing.

$ dmesg
[  746.362842] [7102]: Lid closed.
[  754.655963] [7102]: Lid opened.
[  765.975115] [7102]: Lid closed.
[ 1256.930836] [7102]: Lid opened.
[ 4909.671002] [7102]: Lid closed.
[ 4914.565392] [7102]: Lid opened.
[ 4940.668204] [7102]: Lid closed.
[ 4948.342004] [7102]: Lid opened.
[ 6309.701087] [7102]: Lid closed.
[ 6317.374851] [7102]: Lid opened.
[ 6475.261162] [7102]: Lid closed.
[ 6483.982278] [7102]: Lid opened.
[12216.573741] sysrq: SysRq : Emergency Sync
[12216.574043] Emergency Sync complete
[12217.030881] sysrq: SysRq : Emergency Sync
[12217.031548] Emergency Sync complete
[12217.639123] sysrq: SysRq : Emergency Sync
[12217.639662] Emergency Sync complete
[12218.115483] sysrq: SysRq : Emergency Sync
[12218.115983] Emergency Sync complete
[12218.462908] sysrq: SysRq : Emergency Sync
[12218.463291] Emergency Sync complete
[12219.533405] sysrq: SysRq : Emergency Sync
[12219.533861] Emergency Sync complete
[12228.142422] [7102]: Lid closed.
[12232.069871] [7102]: Lid opened.
$


  I pressed Fn+F1 and the only available display was the internal LCD. I closed the xfce application. Here is more info. Interestingly, xrandr is still thinking current display size is 1920 x 1200 instead of actual 1366x768.

$ xrandr 
Screen 0: minimum 8 x 8, current 1920 x 1200, maximum 32767 x 32767
LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 340mm x 190mm
   1366x768      60.05*+  40.01  
   1280x720      59.74  
   1024x768      60.00  
   1024x576      60.00    59.90    59.82  
   960x540       60.00    59.63    59.82  
   800x600       60.32    56.25  
   864x486       60.00    59.92    59.57  
   640x480       59.94  
   720x405       59.51    60.00    58.99  
   680x384       60.00  
   640x360       59.84    59.32    60.00  
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
$

$ xrandr --listmonitors
Monitors: 1
 0: +*LVDS1 1366/340x768/190+0+0  LVDS1
$ xrandr --listactivemonitors
Monitors: 1
 0: +*LVDS1 1366/340x768/190+0+0  LVDS1
$ xrandr --listproviders
Providers: number : 1
Provider 0: id: 0x47 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 3 outputs: 5 associated providers: 0 name:Intel
$


And because I had 'tail -f .xsession-errors' running here is an update:

UNREF LOADER

(xfsettingsd:7085): xfsettingsd-CRITICAL **: 14:33:52.482: Failed to apply display settings
UNREF LOADER

(xfwm4:7063): xfwm4-WARNING **: 14:34:05.286: output size (1366x768) and logical screen size (1920x1200) do not match

(xfwm4:7063): xfwm4-WARNING **: 14:34:05.300: output size (1366x768) and logical screen size (1920x1200) do not match
UNREF LOADER

(xfsettingsd:7085): xfsettingsd-CRITICAL **: 14:34:06.267: Failed to apply display settings
VALID BACKDROP!
UNREF LOADER


I will attach Xorg.0.log file.
Comment 9 Martin Mokrejš 2018-12-30 14:51:13 CET
Created attachment 8210 
Xorg.0.log

Running on vanilla 4.18.20 kernel.
Comment 10 Andre Miranda editbugs 2018-12-30 18:39:36 CET
Thanks Martin for testing my patch, I'm glad it fixed the problem for you.

With regards to the screen size issues you are facing, I'm 99.9% sure it's not caused by xfdesktop, but xfce4-settings. Have you tried reverting the patch or even disabling xfdesktop (xfdesktop -Q)? I'm confident the behavior will be the same.

Also, have a look at recent improvements to screen management made by Simon: https://simon.shimmerproject.org/
Comment 11 timo.teras 2019-01-03 06:08:38 CET
For me the crash happens reliably when the display is put to power off state (e.g. xrandr --output eDP1 --off). The attached patch fixes the issue for rme too.
Comment 12 Andre Miranda editbugs 2019-01-05 02:55:45 CET
Thanks Timo for testing!

Fix pushed to master:
https://git.xfce.org/xfce/xfdesktop/commit/?id=bbfdae9b69a5fcc5156c1633b385ba6cb81ef4c1

Bug #14609

Reported by:
Paul Menzel
Reported on: 2018-08-17
Last modified on: 2020-04-05
Duplicates (2):
  • 14002 xfdesktop --display :0.0 --sm-client-id ##### crashes at g_type_check_instance_is_fundamentally_a()
  • 14927 xfdesktop crashes after Xscreensaver puts monitor to sleep OR when monitor is powered off, ABRT analyze fails, AMDGPU

People

Assignee:
Eric Koegel
CC List:
6 users

Version

Version:
4.13.2

Attachments

Full backtrace acquired with `bt f` in GDB (7.62 KB, text/plain)
2018-08-17 15:04 CEST , Paul Menzel
no flags
possible-fix.patch (1.56 KB, patch)
2018-12-28 04:00 CET , Andre Miranda
no flags
Xorg.0.log (24.02 KB, text/plain)
2018-12-30 14:51 CET , Martin Mokrejš
no flags

Additional information