Desktop crash on decorations computation

Bug #1904337 reported by Dario Pagani
64
This bug affects 9 people
Affects Status Importance Assigned to Milestone
unity (Ubuntu)
Fix Released
High
Marco Trevisan (Treviño)
Focal
Fix Released
High
Unassigned
Impish
Won't Fix
High
Unassigned

Bug Description

[ Impact ]

Unity crashes while opening new windows.
Happens sporadically while I'm working on kotlin code in Intellij IDEA (2020.3.2) doing anything: navigating around my code or trying to create a new project.

[ Test case ]
 - Launch Android Studio / Intellij IDEA
 - Open new dialogs, browse code
 - Unity should not crash

[ Regression Potential ]

Some shaped windows may not be decorated / shadowed.

---

desktop crashing sometimes with this message (from dmesg)

```
compiz[2768]: segfault at 8 ip 00007f48a463203a sp 00007ffdd41a8d80 error 4 in libunityshell.so[7f48a4536000+345000]
Code: 02 00 00 48 89 93 48 02 00 00 48 85 ff 74 1b e8 9c b6 f5 ff 48 8b 7c 24 28 48 85 ff 74 05 e8 8d b6 f5 ff 48 8b 83 40 02 00 00 <48> 8b 50 08 48 39 50 10 0f 84 1c 01 00 00 4c 8b 32 4d 85 f6 0f 84
```

Seems to be a bug in libunityshell or in some compiz plugin.

Best way to replicate is to install `joystick` and run `ffmvforce test` (or real force feedback device if you have one plugged in), now the desktop crashes. Sometimes other programs (especially if they’re run with Wine) present this behavior. I’ve also tried on liveusb on both Intel and Amd machines with the same result.

ProblemType: BugDistroRelease: Ubuntu 20.04
Package: libunity-core-6.0-9 7.5.0+20.04.20200312-0ubuntu1
ProcVersionSignature: Ubuntu 5.4.0-53.59-generic 5.4.65
Uname: Linux 5.4.0-53-generic x86_64
.tmp.unity_support_test.0:

ApportVersion: 2.20.11-0ubuntu27.12
Architecture: amd64
BootLog: Error: [Errno 13] Permesso negato: '/var/log/boot.log'
CasperMD5CheckResult: skip
CompositorRunning: compiz
CompositorUnredirectDriverBlacklist: '(nouveau|Intel).*Mesa 8.0'
CompositorUnredirectFSW: true
CurrentDesktop: Unity:Unity7:ubuntu
Date: Sun Nov 15 18:02:24 2020
DistUpgraded: Fresh install
DistroCodename: focal
DistroVariant: ubuntu
GraphicsCard:
 Intel Corporation HD Graphics 620 [8086:5916] (rev 02) (prog-if 00 [VGA controller])
   Subsystem: Lenovo HD Graphics 620 [17aa:5062]
InstallationDate: Installed on 2020-06-02 (166 days ago)
InstallationMedia: Ubuntu Unity 20.04 LTS amd64 "Focal Fossa" (20200528)
MachineType: LENOVO 20HN0013IX
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.4.0-53-generic root=UUID=f4fccb8d-474f-4235-bf9d-f2743c46e784 ro quiet splash vt.handoff=7SourcePackage: unity
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 06/28/2020
dmi.bios.vendor: LENOVO
dmi.bios.version: R0IET62W (1.40 )
dmi.board.asset.tag: Not Available
dmi.board.name: 20HN0013IX
dmi.board.vendor: LENOVO
dmi.board.version: SDK0J40697 WIN
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: None
dmi.modalias: dmi:bvnLENOVO:bvrR0IET62W(1.40):bd06/28/2020:svnLENOVO:pn20HN0013IX:pvrThinkPadX270:rvnLENOVO:rn20HN0013IX:rvrSDK0J40697WIN:cvnLENOVO:ct10:cvrNone:
dmi.product.family: ThinkPad X270
dmi.product.name: 20HN0013IX
dmi.product.sku: LENOVO_MT_20HN_BU_Think_FM_ThinkPad X270
dmi.product.version: ThinkPad X270
dmi.sys.vendor: LENOVO
version.compiz: compiz 1:0.9.14.1+20.04.20200211-0ubuntu1
version.libdrm2: libdrm2 2.4.101-2
version.libgl1-mesa-dri: libgl1-mesa-dri 20.0.8-0ubuntu1~20.04.1
version.libgl1-mesa-glx: libgl1-mesa-glx N/A
version.xserver-xorg-core: xserver-xorg-core 2:1.20.8-2ubuntu2.4
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev N/A
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:19.1.0-1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917+git20200226-1
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.16-1

Related branches

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in unity (Ubuntu):
status: New → Confirmed
Revision history for this message
saulius (saulius-m) wrote :
Revision history for this message
Dario Pagani (scarburato) wrote :

Anyway this is how worked around the issue
https://discourse.ubuntu.com/t/testing-unity-session-in-focal-fossa-20-04/13692/158
Basically I've removed the function unity::decoration::Window::Impl::ComputeShapedShadowQuad

Revision history for this message
Uladzislau Nikalayevich (thenormalnij) wrote :

This issue affects Android studio also. I fixed the crash via this changes.
```
diff --git a/decorations/DecoratedWindow.cpp b/decorations/DecoratedWindow.cpp
index ed5548f5e..72096765b 100644
--- a/decorations/DecoratedWindow.cpp
+++ b/decorations/DecoratedWindow.cpp
@@ -750,6 +750,9 @@ void Window::Impl::ComputeShapedShadowQuad()
   unsigned int radius = active() ? manager_->active_shadow_radius() : manager_->inactive_shadow_radius();

   Shape shape(win_->id());
+ if (shape.GetRectangles().size() == 0)
+ return;
+
   auto const& border = win_->borderRect();
   auto const& shadow_offset = manager_->shadow_offset();

```
This code avoid invalid shape object.
I tested it in Ubuntu 20.04 virtual machine. Now compiz doesn't crash after `ffmvforce test`.
Thanks you for the easy reproduction way.

summary: - Desktop crash
+ Desktop crash on decorations computation
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks for the hint, there are now MRs for handling this.

Focal PPA package meanwhile: https://launchpad.net/~ci-train-ppa-service/+archive/4693/

Let me know if anything is not going as expected.

description: updated
Changed in unity (Ubuntu):
status: Confirmed → In Progress
Changed in unity (Ubuntu Focal):
status: New → In Progress
Changed in unity (Ubuntu Impish):
status: New → In Progress
Changed in unity (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Revision history for this message
Robie Basak (racb) wrote :

The fix for this has been uploaded to jammy-proposed.

Changed in unity (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Robie Basak (racb) wrote : Please test proposed package

Hello Dario, or anyone else affected,

Accepted unity into impish-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unity/7.5.1+21.10.20211026-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-impish to verification-done-impish. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-impish. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in unity (Ubuntu Impish):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-impish
Changed in unity (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed-focal
Revision history for this message
Robie Basak (racb) wrote :

Hello Dario, or anyone else affected,

Accepted unity into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/unity/7.5.1+20.04.20211026.1-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.5.1+22.04.20211026.2-0ubuntu1

---------------
unity (7.5.1+22.04.20211026.2-0ubuntu1) jammy; urgency=medium

  [ Uladzislau Nikalayevich ]
  * DecoratedWindow: Do not try to use shaped shadows on empty quads.
    Windows may have no shaped rectangles, but we're still trying to set
    them. This is because we might not initialize the shape size, leading
    to invalid values. (LP: #1904337)

  [ Marco Trevisan (Treviño) ]
  * DecorationsShape: Initialize parameters on missing rectangles.
    In such case the shape should just be empty, but we didn't really handle
    the case properly.
  * dummy-xorg-test-runner: Use command -v instead of deprecated which
  * TestSwitchController: Do not define FakeApplicationWindow as NiceMock twice.
    It's already used as ::Nice later, no need to define it initially,
    otherwise newer gtest won't compile

 -- Marco Trevisan (Treviño) <mail@3v1n0.net> Tue, 26 Oct 2021 17:36:55 +0000

Changed in unity (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Uladzislau Nikalayevich (thenormalnij) wrote :

System: Ubuntu 20.04 focal
Package: Unity 7.5.1+20.04.20211026.1-0ubuntu1

Today I was working in Android Studio. I made a long session (~4 hours) without any crashes. Usually Android Studio randomly crashes my DE every 15 minutes. I didn't see any new additional graphical bugs.
Sometime i saw undercoated Ubuntu error windows "Unable to mount <My phone name>. Couldn't find matching udev device", but it's a old bug, i saw it on unity 7.5.0+20.04.20210409.0-0ubuntu1.
I restarted compiz via command `compiz --replace --debug`. I saw messages in console like this:

```
ERROR 2021-10-28 22:52:59 unity.decoration.shape DecorationsShape.cpp:78 Failed to get shape rectangles
ERROR 2021-10-28 22:52:59 unity.decoration.shape DecorationsShape.cpp:78 Failed to get shape rectangles
```
Unity handles this error property for me now. This happens when you click on menu bar item and fast moves your cursor over menu bar.

tags: added: verification-done-focal
removed: verification-needed-focal
Mathew Hodson (mhodson)
Changed in unity (Ubuntu):
importance: Undecided → High
Changed in unity (Ubuntu Focal):
importance: Undecided → High
Changed in unity (Ubuntu Impish):
importance: Undecided → High
Revision history for this message
Uladzislau Nikalayevich (thenormalnij) wrote :

System: Ubuntu 21.10.
Package: 7.5.1+21.10.20210601.1-0ubuntu1

Bug doesn't affect this system with the original package from impish repo.
Bug doesn't affect Ubuntu 20.10 with 7.5.1+21.10.20210601.1-0ubuntu1 package also. I've added impish repo in sources.list and updated unity package with dependencies for this.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package unity - 7.5.1+20.04.20211026.1-0ubuntu1

---------------
unity (7.5.1+20.04.20211026.1-0ubuntu1) focal; urgency=medium

  [ Uladzislau Nikalayevich ]
  * DecoratedWindow: Do not try to use shaped shadows on empty quads.
    Windows may have no shaped rectangles, but we're still trying to set
    them. This is because we might not initialize the shape size, leading
    to invalid values. (LP: #1904337)

  [ Marco Trevisan (Treviño) ]
  * DecorationsShape: Initialize parameters on missing rectangles.
    In such case the shape should just be empty, but we didn't really handle
    the case properly. (LP: #1904337)

 -- Marco Trevisan (Treviño) <mail@3v1n0.net> Tue, 26 Oct 2021 12:40:42 +0000

Changed in unity (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Robie Basak (racb) wrote : Update Released

The verification of the Stable Release Update for unity has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Assuming the very same change fixed things in focal, I think we can safely mark as verified also for impish (not to regress in case of updates).

tags: added: verification-done-impish
removed: verification-needed-impish
Revision history for this message
Brian Murray (brian-murray) wrote :

I don't think it is safe to mark this as verified without actually following the verification steps, subsequently I'm reverting the tag changes.

tags: added: verification-needed-impish
removed: verification-done-impish
Revision history for this message
Brian Murray (brian-murray) wrote :

Ubuntu 21.10 (Impish Indri) has reached end of life, so this bug will not be fixed for that specific release.

Changed in unity (Ubuntu Impish):
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.