GNOME Bugzilla – Bug 786008
Constant updating of window positions causing high CPU load
Last modified: 2017-08-16 10:26:42 UTC
When dragging the devhelp window (on X11) I see a constant stream of settings updates, causing dconf-service to consume up to 50% CPU on this machine. --- 8< --- method return time=1502208033.770168 sender=:1.34 -> destination=:1.160 serial=1109 reply_serial=556 string ":1.34:user:553" signal time=1502208033.770475 sender=:1.34 -> destination=(null destination) serial=1110 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/maximized" array [ string "" ] string ":1.34:user:553" method call time=1502208033.770554 sender=:1.160 -> destination=ca.desrt.dconf serial=558 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 68 65 69 67 68 74 00 00 00 00 00 f9 02 00 00 00 69 00 2c 38 ] method return time=1502208033.772327 sender=:1.34 -> destination=:1.160 serial=1111 reply_serial=557 string ":1.34:user:554" signal time=1502208033.772626 sender=:1.34 -> destination=(null destination) serial=1112 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/width" array [ string "" ] string ":1.34:user:554" method call time=1502208033.772697 sender=:1.160 -> destination=ca.desrt.dconf serial=559 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 78 2d 70 6f 73 69 74 69 6f 6e 00 b1 0d 00 00 00 69 00 30 38 ] method return time=1502208033.774631 sender=:1.34 -> destination=:1.160 serial=1113 reply_serial=558 string ":1.34:user:555" signal time=1502208033.775201 sender=:1.34 -> destination=(null destination) serial=1114 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/height" array [ string "" ] string ":1.34:user:555" method call time=1502208033.775416 sender=:1.160 -> destination=ca.desrt.dconf serial=560 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 79 2d 70 6f 73 69 74 69 6f 6e 00 2b 03 00 00 00 69 00 30 38 ] method return time=1502208033.777047 sender=:1.34 -> destination=:1.160 serial=1115 reply_serial=559 string ":1.34:user:556" signal time=1502208033.777388 sender=:1.34 -> destination=(null destination) serial=1116 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/x-position" array [ string "" ] string ":1.34:user:556" method return time=1502208033.780035 sender=:1.34 -> destination=:1.160 serial=1117 reply_serial=560 string ":1.34:user:557" signal time=1502208033.780364 sender=:1.34 -> destination=(null destination) serial=1118 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/y-position" array [ string "" ] string ":1.34:user:557" method call time=1502208033.796596 sender=:1.160 -> destination=ca.desrt.dconf serial=561 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 6d 61 78 69 6d 69 7a 65 64 00 00 00 00 62 00 2f 35 ] method call time=1502208033.796725 sender=:1.160 -> destination=ca.desrt.dconf serial=562 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 77 69 64 74 68 00 00 00 00 00 00 35 05 00 00 00 69 00 2b 38 ] method return time=1502208033.799274 sender=:1.34 -> destination=:1.160 serial=1119 reply_serial=561 string ":1.34:user:558" signal time=1502208033.799746 sender=:1.34 -> destination=(null destination) serial=1120 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/maximized" array [ string "" ] string ":1.34:user:558" method call time=1502208033.799819 sender=:1.160 -> destination=ca.desrt.dconf serial=563 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 6d 61 78 69 6d 69 7a 65 64 00 00 00 00 62 00 2f 35 ] method return time=1502208033.802153 sender=:1.34 -> destination=:1.160 serial=1121 reply_serial=562 string ":1.34:user:559" signal time=1502208033.802667 sender=:1.34 -> destination=(null destination) serial=1122 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/width" array [ string "" ] string ":1.34:user:559" method call time=1502208033.802788 sender=:1.160 -> destination=ca.desrt.dconf serial=564 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 77 69 64 74 68 00 00 00 00 00 00 35 05 00 00 00 69 00 2b 38 ] method return time=1502208033.804261 sender=:1.34 -> destination=:1.160 serial=1123 reply_serial=563 string ":1.34:user:560" signal time=1502208033.804665 sender=:1.34 -> destination=(null destination) serial=1124 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/maximized" array [ string "" ] string ":1.34:user:560" method call time=1502208033.804741 sender=:1.160 -> destination=ca.desrt.dconf serial=565 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 68 65 69 67 68 74 00 00 00 00 00 f9 02 00 00 00 69 00 2c 38 ] method return time=1502208033.806511 sender=:1.34 -> destination=:1.160 serial=1125 reply_serial=564 string ":1.34:user:561" signal time=1502208033.806922 sender=:1.34 -> destination=(null destination) serial=1126 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/width" array [ string "" ] string ":1.34:user:561" method call time=1502208033.807142 sender=:1.160 -> destination=ca.desrt.dconf serial=566 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 78 2d 70 6f 73 69 74 69 6f 6e 00 d2 0d 00 00 00 69 00 30 38 ] method return time=1502208033.809042 sender=:1.34 -> destination=:1.160 serial=1127 reply_serial=565 string ":1.34:user:562" signal time=1502208033.809485 sender=:1.34 -> destination=(null destination) serial=1128 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/height" array [ string "" ] string ":1.34:user:562" method call time=1502208033.809562 sender=:1.160 -> destination=ca.desrt.dconf serial=567 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 79 2d 70 6f 73 69 74 69 6f 6e 00 38 03 00 00 00 69 00 30 38 ] method return time=1502208033.811426 sender=:1.34 -> destination=:1.160 serial=1129 reply_serial=566 string ":1.34:user:563" signal time=1502208033.813912 sender=:1.34 -> destination=(null destination) serial=1130 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/x-position" array [ string "" ] string ":1.34:user:563" method return time=1502208033.814681 sender=:1.34 -> destination=:1.160 serial=1131 reply_serial=567 string ":1.34:user:564" signal time=1502208033.814955 sender=:1.34 -> destination=(null destination) serial=1132 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/y-position" array [ string "" ] string ":1.34:user:564" method call time=1502208033.829248 sender=:1.160 -> destination=ca.desrt.dconf serial=568 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 6d 61 78 69 6d 69 7a 65 64 00 00 00 00 62 00 2f 35 ] method call time=1502208033.829342 sender=:1.160 -> destination=ca.desrt.dconf serial=569 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 77 69 64 74 68 00 00 00 00 00 00 35 05 00 00 00 69 00 2b 38 ] method return time=1502208033.832005 sender=:1.34 -> destination=:1.160 serial=1133 reply_serial=568 string ":1.34:user:565" signal time=1502208033.832477 sender=:1.34 -> destination=(null destination) serial=1134 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/maximized" array [ string "" ] string ":1.34:user:565" method call time=1502208033.833305 sender=:1.160 -> destination=ca.desrt.dconf serial=570 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 6d 61 78 69 6d 69 7a 65 64 00 00 00 00 62 00 2f 35 ] method return time=1502208033.834631 sender=:1.34 -> destination=:1.160 serial=1135 reply_serial=569 string ":1.34:user:566" signal time=1502208033.835389 sender=:1.34 -> destination=(null destination) serial=1136 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/width" array [ string "" ] string ":1.34:user:566" method call time=1502208033.835544 sender=:1.160 -> destination=ca.desrt.dconf serial=571 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 77 69 64 74 68 00 00 00 00 00 00 35 05 00 00 00 69 00 2b 38 ] method return time=1502208033.837227 sender=:1.34 -> destination=:1.160 serial=1137 reply_serial=570 string ":1.34:user:567" signal time=1502208033.837603 sender=:1.34 -> destination=(null destination) serial=1138 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/maximized" array [ string "" ] string ":1.34:user:567" method call time=1502208033.837640 sender=:1.160 -> destination=ca.desrt.dconf serial=572 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 68 65 69 67 68 74 00 00 00 00 00 f9 02 00 00 00 69 00 2c 38 ] method return time=1502208033.839411 sender=:1.34 -> destination=:1.160 serial=1139 reply_serial=571 string ":1.34:user:568" signal time=1502208033.839799 sender=:1.34 -> destination=(null destination) serial=1140 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/width" array [ string "" ] string ":1.34:user:568" method call time=1502208033.839845 sender=:1.160 -> destination=ca.desrt.dconf serial=573 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 78 2d 70 6f 73 69 74 69 6f 6e 00 f0 0d 00 00 00 69 00 30 38 ] method return time=1502208033.841837 sender=:1.34 -> destination=:1.160 serial=1141 reply_serial=572 string ":1.34:user:569" signal time=1502208033.842328 sender=:1.34 -> destination=(null destination) serial=1142 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/height" array [ string "" ] string ":1.34:user:569" method call time=1502208033.842388 sender=:1.160 -> destination=ca.desrt.dconf serial=574 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Change array of bytes [ 2f 6f 72 67 2f 67 6e 6f 6d 65 2f 64 65 76 68 65 6c 70 2f 73 74 61 74 65 2f 6d 61 69 6e 2f 77 69 6e 64 6f 77 2f 79 2d 70 6f 73 69 74 69 6f 6e 00 2f 03 00 00 00 69 00 30 38 ] method return time=1502208033.844243 sender=:1.34 -> destination=:1.160 serial=1143 reply_serial=573 string ":1.34:user:570" signal time=1502208033.844628 sender=:1.34 -> destination=(null destination) serial=1144 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/x-position" array [ string "" ] string ":1.34:user:570" method return time=1502208033.846679 sender=:1.34 -> destination=:1.160 serial=1145 reply_serial=574 string ":1.34:user:571" signal time=1502208033.847003 sender=:1.34 -> destination=(null destination) serial=1146 path=/ca/desrt/dconf/Writer/user; interface=ca.desrt.dconf.Writer; member=Notify string "/org/gnome/devhelp/state/main/window/y-position" array [ string "" ] string ":1.34:user:571"
Created attachment 357407 [details] [review] Window: Save the settings after dragging is done Based on what applications like Documents and Photos do.
Review of attachment 357407 [details] [review]: I'm not sure that saving the x/y position is useful, it's better to let the window manager position the window. Anyway, even if we keep the code to restore the x/y position, what I would do is to save the GSettings only when needed: - when closing a DhWindow. - just before creating a second/third/… DhWindow, save the GSettings of the active DhWindow.
(In reply to Sébastien Wilmet from comment #2) > Review of attachment 357407 [details] [review] [review]: > > I'm not sure that saving the x/y position is useful, it's better to let the > window manager position the window. It also saves the dimensions, which is something that's useful on Wayland too. > Anyway, even if we keep the code to restore the x/y position, what I would > do is to save the GSettings only when needed: > - when closing a DhWindow. > - just before creating a second/third/… DhWindow, save the GSettings of the > active DhWindow. The problem with that might be crashes after the resize and before the saving.
Yes, saving the dimensions and the maximized state. If Devhelp crashes, it's really not a big problem if it hasn't saved those settings.
totem only saves its dimensions on exit. Given that the window manager might want to place you in a different spot on launch, and that this isn't even in the application's control on Wayland, I'd make this as simple as possible, and save the dimensions before hiding the window.
Well, there is an entire HowDoI on this: https://wiki.gnome.org/HowDoI/SaveWindowState :) I won't have time to iterate on this. It was a fly-by patch to fix an obvious problem. So feel free to replace my patch with some more suitable.
It's anyway not a recent regression in Devhelp, I think the problem exists since the migration to GSettings in 2012 with commit fe40e7ee0a77bc6cc1ee3c7917a0a58be4b3d30b. And the world has continued to turn.
Review of attachment 357407 [details] [review]: I wanted to apply this patch because I'm probably not going to fix this bug this cycle the way I want. But the patch cannot be applied as-is, priv->configure_id is never set! So since this bug anyway requires more work, it's probably better to fix it the way that I described, to have a simpler solution. ::: src/dh-window.c @@ +659,2 @@ { + DhWindow *window = user_data; DH_WINDOW (user_data); is better. @@ +688,3 @@ + } + + g_timeout_add (WINDOW_SETTINGS_SAVE_TIMEOUT_MSECS, window_settings_save_cb, dh_window); priv->configure_id is never set, it should probably be set here. Since it is a timeout a better name would be configure_timeout_id. @@ +700,3 @@ + GdkEventAny *event) +{ + DhWindow *dh_window = DH_WINDOW(window); A space is missing before the parenthesis.
(In reply to Sébastien Wilmet from comment #8) > Review of attachment 357407 [details] [review] [review]: > I wanted to apply this patch because I'm probably not going to fix this bug > this cycle the way I want. > > But the patch cannot be applied as-is, priv->configure_id is never set! > > So since this bug anyway requires more work, it's probably better to fix it > the way that I described, to have a simpler solution. It'd be a shame if users were subject to this bug for a few more weeks just because nobody could spare the few seconds to assign priv->configure_id. :) > ::: src/dh-window.c > @@ +659,2 @@ > { > + DhWindow *window = user_data; > > DH_WINDOW (user_data); is better. > > [...] > > @@ +700,3 @@ > + GdkEventAny *event) > +{ > + DhWindow *dh_window = DH_WINDOW(window); > > A space is missing before the parenthesis. Fixed. The file uses conflicting coding styles. I had picked one at random.
Created attachment 357702 [details] [review] Window: Save the settings after dragging is done
OK, it will do its job. Attachment 357702 [details] pushed as 8548351 - Window: Save the settings after dragging is done
Thanks, Sébastien!