Public bug reported:

Since mutter 46.2-1ubuntu0.24.04.13 (SRU for LP: #1971434), the
compositor aborts about 3 seconds after resume if a monitor connected
through a DisplayPort MST dock was unplugged while the laptop was
suspended:

libmutter:ERROR:../src/backends/native/meta-kms-impl-
device.c:2006:meta_kms_impl_device_unhold_fd: assertion failed:
(meta_kms_in_impl_task (kms))

The whole session is lost.

Upstream report, with full analysis:
https://gitlab.gnome.org/GNOME/mutter/-/work_items/5136

[Versions]
- mutter 46.2-1ubuntu0.24.04.16 and 46.2-1ubuntu0.24.04.18 (noble-updates). 
Both crash.
- The code comes from the two patches backported in .13 from upstream MR !4610:
  backends-native-kms-connector-Notify-disconnect-events-af.patch
  kms-connector-Only-trigger-a-connector-update-on-disconne.patch
  46.2-1ubuntu0.24.04.12 does not contain them.
- Distribution: elementary OS 8.1, which uses the unmodified Ubuntu noble 
mutter packages. Its compositor (Gala) is built on libmutter-14.
- Kernel 6.16.12, Framework Laptop 13 (AMD Ryzen AI 9 HX 370, amdgpu), HP 
Thunderbolt 4 G6 dock (DisplayPort MST) with a 3840x2160 monitor

[Steps to reproduce]
1. Connect an external monitor through a DisplayPort MST dock.
2. Lock the screen and suspend.
3. Unplug the dock while suspended.
4. Resume.

Result: about 3 seconds after resume the compositor aborts with the
assertion above. It happened once in normal use and in 2 of 2 deliberate
attempts. Unplugging the dock while the session is unlocked and active
does not crash. I expect a monitor connected directly (not through MST)
not to trigger it, because its connector isn't destroyed, but I haven't
tested that with the unpatched package.

[Cause]
connection_change_timeout() -> update_connector() holds an extra reference to 
the MetaKmsConnector on the main thread while the impl task updates the device 
state. MST connectors are destroyed by the kernel when the dock goes away, so 
the impl task drops the connector and the main thread then releases the last 
reference. meta_kms_connector_finalize() then calls 
meta_kms_impl_device_unhold_fd() outside the KMS impl thread, which asserts.

Backtrace (46.2-1ubuntu0.24.04.18, symbolized):
#7  meta_kms_impl_device_unhold_fd () at 
../src/backends/native/meta-kms-impl-device.c:2006
#8  meta_kms_connector_finalize () at 
../src/backends/native/meta-kms-connector.c:1776
#9  g_object_unref ()
#13 update_connector () at ../src/backends/native/meta-kms-connector.c:1063
#14 connection_change_timeout () at 
../src/backends/native/meta-kms-connector.c:1097
#18 g_main_loop_run ()
#19 meta_context_run_main_loop () at ../src/core/meta-context.c:523

[Fix]
Attached: kms-connector-Release-connector-reference-in-impl-task.patch (against 
46.2-1ubuntu0.24.04.18). It hands the reference over to the impl task so the 
connector is finalized in the impl thread. It also includes a backport of 
upstream commit de07dcb1 ("kms/connector: Update KMS resource lists in 
update_connector_in_impl", GNOME/mutter#4796), which otherwise leaves the 
MetaKmsDevice lists pointing at the finalized connector.

Tested as a local rebuild of 46.2-1ubuntu0.24.04.18: 3 of 3 runs of the
steps above, no crash.

Related, but a separate issue that is not a regression from this SRU:
with the crash fixed, the same steps can leave the screen black after
unlock when the lock screen is an Xorg greeter
(https://gitlab.gnome.org/GNOME/mutter/-/work_items/5137).

** Affects: mutter
     Importance: Unknown
         Status: Unknown

** Affects: mutter (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: noble regression-update

** Patch added: "kms-connector-Release-connector-reference-in-impl-task.patch"
   
https://bugs.launchpad.net/bugs/2170900/+attachment/6009298/+files/kms-connector-Release-connector-reference-in-impl-task.patch

-- 
You received this bug notification because you are a member of Ubuntu
Desktop Bugs, which is subscribed to mutter in Ubuntu.
https://bugs.launchpad.net/bugs/2170900

Title:
  Regression in 46.2-1ubuntu0.24.04.13: compositor aborts in
  meta_kms_impl_device_unhold_fd when a DisplayPort MST monitor
  disappears during suspend

To manage notifications about this bug go to:
https://bugs.launchpad.net/mutter/+bug/2170900/+subscriptions


-- 
desktop-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/desktop-bugs

Reply via email to