GNOME Bugzilla – Bug 766156
X crashes when removing secondary monitor
Last modified: 2016-06-29 14:04:53 UTC
Hi I have installed Linux Citrix reciever. I have opened one XenApp using selfservice. I have two monitors attached. Xinerma extensions are enabled. If i remove the secondary monitor on the fly the X crashes.
Created attachment 327489 [details] Metacity crash logs
What do you expect from Metacity when X crashes? I guess you loose whole session when that happens not only Metacity, right?
(In reply to Alberts Muktupāvels from comment #2) > What do you expect from Metacity when X crashes? I guess you loose whole > session when that happens not only Metacity, right? Hi Alberts, Thanks for the reply. It appears as if crash in X originates from some miscalculation in metacity either when its applying the constraints on Citrix desktop window or during calculation of new placement for window. Metacity logs show some large garbage value for offset and height/width of a window.
Have you tried other window manager in your session? mutter, compiz, marco? Does it crash only with metacity?
Its working with on X86 Compiz 0.9.7.12. My Environment is: Arm, Yocto poky_dizzy_1.7.1 also it works with metacity when xinerama is disabled from build options of metacity
Is there any window fullscreen when you remove secondary monitor?
Created attachment 327500 [details] [review] patch for testing Can you rebuild metacity with this patch and post output you get? Maybe that will help to find why entire_xinerama is so big...
Yes..there is a full screen window when we remove the secondary monitor. We have added the patch created by you along with few more logs to track down the root cause. Will share the result with you.
Created attachment 327554 [details] metacity verbose logs with added warning and prints to track flow Sharing the logs from metacity with your patch. It can be seen on Line 15059 that a big offset is received during calculation of union of rects for entire xinerama. Any Idea whats the idea behind checking for 4 full screen monitor info? Another(or related) potential cause is rect for window recieved in setup_constraint_info() where xineram's offset is 0,0 but windows offset is 1920,0. checking more logs to track it down. Will keep you updated.
From logs and some experimentation problem seems to be this: When both monitors are connected, meta_window_update_fullscreen_monitors( ) is called for Citrix's Desktop window with values for 'left','top' and 'bottom' as 0 and value of 'right' as 1. these values are assigned to window->fullscreen_monitors[] . These values are used as index for monitors (0 and 1 for two available monitors) in screen->xinerama_infos[] for calculation union of monitor rectangles in setup_constraint_info() function. When we disconnect secondary monitor, xinerama_infos is allocated only for single monitor (index 0) but after disconnection meta_window_update_fullscreen_monitors( ) is not called and hence window->fullscreen_monitors[] has the stale values which when used as index for xinerama_infos[] results in invalid memory access corresponding to index=1 and gets garbage value. Placing below condition before meta_rectangle_union() in setup_constraint_info() avoids the above situation and consequently there is no crash. if(monitor >= window->screen->n_xinerama_infos) { continue; } Trying to find possible reason for meta_window_update_fullscreen_monitors( ) not being called after disconnection.
Created attachment 327677 [details] [review] test Does this patch change anything?
It still crashes with this :-(
Can you check if meta_window_update_fullscreen_monitors functions is called when you disconnect secondary monitor? With your if (to check if monitor is valid) so it does not crash... If it is still not called then it is also bug in application. From specification: "In the event of a change in monitor configuration, the application is responsible for re-computing the monitors on which it wants to appear." See: https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472531472 Still metacity should not crash... Probably metacity should remove this info as it is most likely not valid. But I am worried if application can send client message before we clear this list...
Created attachment 327726 [details] [review] constraints: validate fullscreen monitors before using them
Did you test last patch?
Yes ..validating fullscreen monitor avoids the crash and did solve our issue. Thanks a lot for your help