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 760188 - GDK's X11 backend leaks SyncCounters
GDK's X11 backend leaks SyncCounters
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
unspecified
Other Linux
: Normal major
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-01-05 23:42 UTC by Ben Gamari
Modified: 2016-01-11 13:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A patch adding the missing destroy call (979 bytes, patch)
2016-01-05 23:42 UTC, Ben Gamari
committed Details | Review
stacktrace (5.98 KB, text/plain)
2016-01-08 12:55 UTC, Alberts Muktupāvels
  Details
stacktrace2 (6.96 KB, text/plain)
2016-01-08 16:34 UTC, Alberts Muktupāvels
  Details

Description Ben Gamari 2016-01-05 23:42:41 UTC
Created attachment 318300 [details] [review]
A patch adding the missing destroy call

GDK appears to create two X11 SyncCounters per GdkWindow (update_counter and extended_update_counter) however only frees one of them (update_counter). This results in rampant resource leakage in long-running applications (in my case gnome-terminal) eventually making the user's X11 session quite unusable.

Attached is an untested patch. I'll try to test tomorrow.
Comment 1 Matthias Clasen 2016-01-06 14:20:09 UTC
Review of attachment 318300 [details] [review]:

Looks correct. If your testing works out, please push this
Comment 2 Alberts Muktupāvels 2016-01-08 07:52:16 UTC
Now I am getting XSyncBadCounter error. It looks like set_sync_counter can be called with counter == None and XSyncSetCounter does not like it.

Probably can be fixed by adding this in set_sync_counter:
if (counter == None)
  return;
Comment 3 Matthias Clasen 2016-01-08 12:45:01 UTC
(In reply to Alberts Muktupāvels from comment #2)
> Now I am getting XSyncBadCounter error. It looks like set_sync_counter can
> be called with counter == None and XSyncSetCounter does not like it.
> 
> Probably can be fixed by adding this in set_sync_counter:
> if (counter == None)
>   return;

that would just be working around the symptom. I'd rather understand why this patch introduced a problem for you.
Comment 4 Matthias Clasen 2016-01-08 12:50:26 UTC
How do you reproduce your XSyncBadCounter ? I've tried under metacity, and didn't see any
Comment 5 Alberts Muktupāvels 2016-01-08 12:55:45 UTC
Created attachment 318487 [details]
stacktrace
Comment 6 Matthias Clasen 2016-01-08 13:38:05 UTC
does this help ?

diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 9f189ad..cca924d 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -1323,6 +1323,8 @@ gdk_x11_window_destroy (GdkWindow *window,
   if (toplevel)
     gdk_toplevel_x11_free_contents (GDK_WINDOW_DISPLAY (window), toplevel);
 
+  unhook_surface_changed (window);
+
   if (impl->cairo_surface)
     {
       cairo_surface_finish (impl->cairo_surface);
Comment 7 Alberts Muktupāvels 2016-01-08 13:58:49 UTC
(In reply to Matthias Clasen from comment #6)
> does this help ?

No. :( on_surface_changed is still called.
Comment 8 Matthias Clasen 2016-01-08 16:29:54 UTC
Can you get a stacktrace with that patch, please ?
Comment 9 Alberts Muktupāvels 2016-01-08 16:34:38 UTC
Created attachment 318512 [details]
stacktrace2
Comment 10 Ben Gamari 2016-01-11 13:43:45 UTC
I've been running this since the 2016-01-08 or so and have had no issues.