Workspace switching performance degradation due to leaked WeakRefs in JS
Affected version
- NixOS Unstable
- GNOME 45.2
- The problem occurs in Wayland session
- The problem occurs with and without extensions
Bug summary
GNOME Shell starts dropping frames when switching between workspaces after days of use.
Steps to reproduce
The issue can be reproduced by manually switching workspaces a few hundred times by Ctrl+Alt+←/→. The effect is easier to observe if you have a screen with a high refresh rate (>= 120 Hz) and a low-power CPU.
What happened
Dropping frames, gradually getting worse. perf
shows an increased CPU usage in signal_emit_unlocked_R
.
What did you expect to happen
Not slowing down
Relevant logs, screenshots, screencasts etc.
An excerpt from perf report
:
# Total Lost Samples: 0
#
# Samples: 12K of event 'cpu_core/cycles:P/'
# Event count (approx.): 13455524175
#
# Children Self Command Shared Object Symbol >
# ........ ........ ............... ............................. .............................................................................................................................................................................................>
#
91.81% 23.04% .gnome-shell-wr libgobject-2.0.so.0.7800.1 [.] signal_emit_unlocked_R.isra.0
|
|--70.00%--signal_emit_unlocked_R.isra.0
| |
| --69.44%--g_closure_invoke
| |
| |--60.52%--on_source_notify
| | |
| | |--45.79%--g_object_set_property
| | | |
| | | --45.73%--g_object_setv
| | | |
| | | |--32.22%--g_object_notify_queue_thaw
| | | | |
| | | | |--29.18%--st_adjustment_dispatch_properties_changed
| | | | | |
| | | | | --29.13%--g_object_dispatch_properties_changed
| | | | | |
| | | | | --29.00%--g_signal_emit
| | | | | |
| | | | | --28.73%--g_signal_emit_valist
| | | | | |
| | | | | --28.26%--signal_emit_valist_unlocked
| | | | | |
| | | | | |--9.51%--signal_emit_unlocked_R.isra.0
| | | | | | |
| | | | | | |--7.13%--g_closure_invoke
| | | | | | | |
| | | | | | | |--1.75%--on_target_notify
| | | | | | | | |
| | | | | | | | --1.48%--g_weak_ref_get
| | | | | | | | |
| | | | | | | | --0.53%--g_rw_lock_reader_unlock@plt
| | | | | | | |
| | | | | | | --0.83%--g_closure_ref
| | | | | | |
| | | | | | --0.56%--g_mutex_lock@plt
| | | | | |
| | | | | |--3.25%--_g_closure_supports_invoke_va
| | | | | |
| | | | | |--1.90%--g_value_unset
| | | | | | |
| | | | | | --1.09%--g_type_value_table_peek
| | | | | |
| | | | | |--1.69%--value_param_collect_value
| | | | | | |
| | | | | | --1.37%--g_value_type_compatible
| | | | | | |
| | | | | | --1.08%--g_type_value_table_peek
| | | | | | |
| | | | | | --0.54%--g_rw_lock_reader_unlock@plt
| | | | | |
| | | | | |--1.23%--g_hash_table_lookup@plt
| | | | | |
| | | | | |--1.19%--g_type_value_table_peek
| | | | | |
| | | | | --0.56%--g_value_init_from_instance