After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 623235 - BadDamage error from XSubtractDamage
BadDamage error from XSubtractDamage
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
: 623245 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-06-30 19:28 UTC by William Jon McCann
Modified: 2010-09-15 21:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
bt (45.25 KB, text/plain)
2010-06-30 19:28 UTC, William Jon McCann
  Details
Silently drop BadDamage errors (1.70 KB, patch)
2010-07-20 19:23 UTC, drago01
none Details | Review
Silently drop BadDamage errors (1.70 KB, patch)
2010-07-20 19:31 UTC, drago01
rejected Details | Review
Trap xerrors in mutter_window_pre_paint (1.01 KB, patch)
2010-08-23 20:29 UTC, drago01
committed Details | Review

Description William Jon McCann 2010-06-30 19:28:46 UTC
Created attachment 164990 [details]
bt

* Laptop (closed) undocked
 * Suspends
 * Hours later is resumed
 * Screen is not locked but keyboard and pointer are grabbed
 * Screen is not updating (time is still hours earlier)
 * gnome-screensaver-gl-helper is stuck
(https://bugzilla.gnome.org/show_bug.cgi?id=621053)
 * Killing gnome-screensaver-gl-helper causes the screen to lock
 * Unlock the screen
 * Shell crashes  - bt attached

--

Owen says:


It's a BadDamage error from XSubtractDamage, so probably means we need:

  if (priv->received_damage)
   {
+      meta_error_trap_push (display);
     XDamageSubtract (xdisplay, priv->damage, None, None);
+      meta_error_trap_pop (display, FALSE);
     priv->received_damage = FALSE;
   }

In mutter-window.c.

(I'm thinking that X must destroy the damage object when the window is
destroyed? A bit annoying to have to add a round-trip like the above.)
Comment 1 Owen Taylor 2010-06-30 21:08:45 UTC
*** Bug 623245 has been marked as a duplicate of this bug. ***
Comment 2 drago01 2010-07-20 19:23:16 UTC
Created attachment 166235 [details] [review]
Silently drop BadDamage errors

The call to XDamageSubtract in mutter_window_pre_paint might end create a
BadDamage in when the window goes away.

Set up a custom error handler to catch BadDamage errors and silently ignore
them to avoid having to take a roundtrip here.
Comment 3 drago01 2010-07-20 19:31:00 UTC
Created attachment 166236 [details] [review]
Silently drop BadDamage errors

The call to XDamageSubtract in mutter_window_pre_paint might end up create a
BadDamage in when the window goes away.

Set up a custom error handler to catch BadDamage errors and silently ignore
them to avoid having to take a roundtrip here.
Comment 4 Owen Taylor 2010-08-16 18:50:02 UTC
Review of attachment 166236 [details] [review]:

Sorry about the slow response on this one - the patch looks like it should work fine. *But* Metacity and Mutter are full of things that might possibly generate X errors, and we don't use this approach anywhere else - we don't blanket ignore any other type of errors. This was an explicit design choice compared to some other window managers (Enlightenment in particular) that just globally trapped and ignored all errors. Blanket ignoring X errors was considered to be a good way of having code that was just entirely wrong and never noticing.

So, I think I'd rather just eat the round-trip here and do the same thing as the rest of Mutter with errors traps.

If profiling/testing showed that to be a problem, then luminocity (git://git.gnome.org/archive/luminocity) has an "async error trap" implementation that we could borrow for Metacity - the way it works is that it keeps track of when errors were trapped and compares received errors against that historical record.
Comment 5 drago01 2010-08-23 20:29:28 UTC
Created attachment 168589 [details] [review]
Trap xerrors in mutter_window_pre_paint

XDamageSubstract can create a BadDamage (when the window goes away before XDamageSubstract is called)  and thus resulting into a crash.

Fix it by protecting the call with an error trap.
Comment 6 drago01 2010-08-23 20:33:32 UTC
Comment on attachment 168589 [details] [review]
Trap xerrors in mutter_window_pre_paint

Attachment 168589 [details] pushed as 2a54baf - Trap xerrors in mutter_window_pre_paint
---
For the record we went with the straight forward approuch here to fix the crash if the roundtrip really hurts we can revisit it later.