Qt5 applications crash when switching screens

Bug #1450137 reported by Lukas Schrangl
76
This bug affects 14 people
Affects Status Importance Assigned to Milestone
qtdeclarative-opensource-src (Ubuntu)
Fix Released
Medium
Timo Jyrinki
Wily
Fix Released
Medium
Timo Jyrinki

Bug Description

# Impact
When switching screens (e. g. when putting the laptop onto the docking station the notebook screen is turned off and the external one is turned on) Qt5 applications (including plasmashell) quite often crash.

# Test Case
* Have two screens. One plugged-in one not
* Run plasma 5
* Plug-in second screen and wait 10 seconds
* Unplug and wait 10 seconds
* Plug-in and wait 10 seconds
* Unplug and wait 10 seconds
* ...

# Regression Potential
Worst case scenario an application using qquickscreen would slow down because of erroneous screen change singals being emitted too often per second. This would however only reveal a lower level issue in the foundations that ultimately needs to be fixed anyway.

# Other Info
The upstream code review [1] explains the issue and solution pretty well.

https://codereview.qt-project.org/#/c/111100/

--------- original report ---------------

When switching screens (e. g. when putting the laptop onto the docking station the notebook screen is turned off and the external one is turned on) Qt5 applications (including plasmashell) quite often crash. This makes my laptop unusable, since I do that very frequently.

The problem has already been described here: https://bugs.kde.org/show_bug.cgi?id=341497
Apparently it is fixed in Qt 5.5

I am running Kubuntu 15.04 64bit and libqt5gui5 5.4.1+dfsg-2ubuntu4.

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

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

Changed in qtbase-opensource-src (Ubuntu):
status: New → Confirmed
Revision history for this message
Antonis Kanouras (akanouras) wrote :

This has affected all Plasma 5 releases in Kubuntu since Utopic, including the current backport of Plasma 5.3.

It reliably triggers a cascade of crashes in at least krunner, plasma and kwin on every screen topology change, making for a very disconcerting user experience.

Please consider cherry-picking https://codereview.qt-project.org/#/c/111100/ for Qt < 5.4.2, Fedora and OpenSUSE have already done so.

You can find more details in https://bugs.kde.org/show_bug.cgi?id=345544 .

no longer affects: plasma-workspace (Ubuntu)
no longer affects: kwin (Ubuntu)
affects: qtbase-opensource-src (Ubuntu) → qtdeclarative-opensource-src (Ubuntu)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

There's another qtdeclarative landing pending to go to wily. Then this'd go into wily, and then a backport of this to vivid. It will take some time.

Changed in qtdeclarative-opensource-src (Ubuntu Vivid):
status: New → Confirmed
Changed in qtdeclarative-opensource-src (Ubuntu):
assignee: nobody → Timo Jyrinki (timo-jyrinki)
importance: Undecided → Medium
Changed in qtdeclarative-opensource-src (Ubuntu Vivid):
importance: Undecided → Medium
description: updated
Changed in qtdeclarative-opensource-src (Ubuntu Wily):
status: Confirmed → In Progress
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Can anyone test on wily (or just add the PPA for wily on vivid) with the 5.4.1-1ubuntu8 version from https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-002 ?

I still get a crash of Qt Creator when plugging/unplugging with the patch included. Does it improve the situation for anyone?

Changed in qtdeclarative-opensource-src (Ubuntu Wily):
status: In Progress → Incomplete
Revision history for this message
Harald Sitter (apachelogger) wrote :

Tried it, doesn't fix plasmashell exploding (not in the particular test case presented anyway). A bit of research suggests that this type of issue has multiple causes and is in fact only fixed by a combination of multiple commits (see the code review tabs on the bug reports below).
The last bug in particular seems to carry the majority of relevant patches.

https://bugreports.qt.io/browse/QTBUG-32973
https://bugreports.qt.io/browse/QTBUG-32681
https://bugreports.qt.io/browse/QTBUG-42985

I am not sure how to proceed on this. The additional patches seem to only affect qxcb such that they could only regress !phone apps (e.g. kubuntu-desktop). They are however numerous making this more work and more likely to cause regressions in other parts.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

The bug https://bugs.kde.org/show_bug.cgi?id=345544 linked from https://bugreports.qt.io/browse/QTBUG-45753 (linked from https://codereview.qt-project.org/#/c/111100/) has a claim from Stefan that he doesn't see a particular crash anymore with Fedora's patched Qt. The only relevant patch in that Fedora qtdeclarative seems to be this same patch, so can maybe someone try to reproduce the crasher described in that bug and then confirm it'd be fixed by the PPA?

That we way we could get at least one crasher fix in for starters.

Revision history for this message
Antonis Kanouras (akanouras) wrote :

I did a few tests:

On the first reboot after installing qtdeclarative from the Wily PPA on Vivid, I probably got lucky and managed to plug/unplug the external monitor 4 times before the first crash (nvidia-340's xrandr also stopped detecting changes for the next 2 topology changes at that point, although that's nothing new).

On subsequent reboots I'm getting Plasma/Kwin/Konsole crashes on almost every screen change.
Some changes in behaviour that I noticed:

1. Dr. Konqi is started for kwin crashes, but no window appears (no mention of it in xlsclients either).
2. Dr. Konqi is not started for plasmashell crashes (crashes on almost every screen change).
3. Dr. Konqi is not started for Konsole crashes (crashes on every screen change).
4. krunner does not crash on screen change - it crashes instead when called with Alt+F2, with Dr. Konqi appearing. It doesn't allow me to report krunner crashes by the way, but that's another bug. The backtrace (which I'm attaching) is different this time, there's no physicalSize() in it. Luckily it's restarted right after usually, so there's a way to recover manually.
5. System Settings 5 also usually crashes around screen changes; that's caught by apport however, which gives me zero information.
6. Usually after a crash, the Plasma panel flickers, with only the spacer being displayed when not flickering, and can't be clicked. Disabling composition with the shortcut works around this.

All in all, I'd say the behaviour has improved a bit, as regards the frequency of crashes; however, losing Dr. Konqi is mildly disappointing.

I have to apologise here for jumping on this patch without having tested it myself first. I'll try pre-attaching gdb to kwin/plasmashell/konsole to get backtraces out of them, and a Fedora install in the next days to see if the crashes are really fixed, at least on my machine, and report back.

Revision history for this message
Antonis Kanouras (akanouras) wrote :
Revision history for this message
Antonis Kanouras (akanouras) wrote :
Revision history for this message
Antonis Kanouras (akanouras) wrote :

I managed to get backtraces out of Konsole & Plasma, excuse the poor quality of them as I only remembered to log output after I started gdb.

In all 3 cases they're now crashing in QScreen::handle() with (this=this@entry=0x0) .

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

I think it starts to sound like it would be useful to land this fix in wily to get also more exposure to the fix, but maybe not worth starting an SRU at this point. The impact seems to be either a) low or b) a bit unpredictable on the actual problem users are seeing. If it turns out we can get also other fixes landed to wily and they together would have a bigger improvement, the SRU could be considered later?

Revision history for this message
Antonis Kanouras (akanouras) wrote :

Re: the impact, I guess it affects users on laptops that regularly (dis)connect external screens (eg. using same laptop at work & home or connecting the laptop to a TV to watch a movie) without shutting down the machine. From the few (<10) Kubuntu 15.04 installations I can be blamed for, I'm the only one who noticed the bug even though I managed to reproduce it on all of them.

Anyway, after reading the qtbugs and trying to cherry-pick a few relevant upstream commits, I think Qt 5.4.1 is a lost cause for this bug at this point, so feel free to postpone/cancel this SRU.

As my next steps, I'll try Fedora, and also 5.4.2 & 5.5 on Vivid & Wily to see if I can reproduce it. Will take a few days however. :/

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Yes, you're correct even though I meant the (positive) impact of landing the current fix being low :)

I agree about canceling the SRU at least for now. Qt 5.5 will have the fix in wily eventually, but if there's something to be done with the 5.4 series that seriously improves the situation we can come back to considering vivid.

Qt 5.5 alpha for vivid is partially at https://launchpad.net/~ci-train-ppa-service/+archive/ubuntu/landing-012/ but not enough to run Plasma 5 (Unity 8 ok). I'll build beta just being released for wily in the same PPA.

no longer affects: qtdeclarative-opensource-src (Ubuntu Vivid)
Changed in qtdeclarative-opensource-src (Ubuntu Wily):
status: Incomplete → Confirmed
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Silo 002 with the not so complete fix was no freed to be reused for other purposes. I made a backup of the package to https://launchpad.net/~timo-jyrinki/+archive/ubuntu/ppa/+packages though.

Revision history for this message
Arne Henningsen (arne-henningsen-6) wrote :

I guess that this is the same bug as:

https://bugs.kde.org/show_bug.cgi?id=349197

A developer at bugs.kde.org claims that this bug was fixed in Qt version 5.4.2 and I got the advice to upgrade from Qt version 5.4.1 to version 5.4.2. Is there a PPA with Qt 5.4.2 for (K)Ubuntu 15.04 or another easy (and low-risk) way to upgrade Qt to version 5.4.2?

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Unfortunately there's no Qt 5.4.2 PPA for 15.04, and no backportable commits have been found that would actually fix the problem.

However, as of an hour ago 15.10 now has Qt 5.4.2, so marking this bug as fixed even though the bug number was not included in the bug report. Testing whether Qt 5.4.2 actually fixed the problem in wily would be welcome.

---

qtbase-opensource-src (5.4.2+dfsg-2ubuntu1) wily; urgency=medium

  * New upstream release.
  * Drop additional cherry-picked patches now included:
    - make-sure-there-s-a-scene.patch
    - upstream-gerrit_Handle-SelectionWindowDestroy-in-QXcbClipboard.patch
    - upstream_Call-ofono-nm-Registered-delayed-in-constructor-othe.patch
    - upstream_xcb-Update-mouse-buttons-from-MotionNotify-events.patch
    - upstream_xcb_use_themed_cursor.patch
    - enable_pie.patch
  * Bump ABI:s in symbols files
  * Update symbols from build logs.

 -- Timo Jyrinki <email address hidden> Wed, 10 Jun 2015 11:45:56 +0000

Changed in qtdeclarative-opensource-src (Ubuntu Wily):
status: Confirmed → Fix Released
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

s/in the bug report/in the changelog/

Revision history for this message
Marco Cimmino (cimmo) wrote :

I cannot use Willy at the moment, but some other user on Arch Linux found out that the workaround in Qt 5.4.2 isn't fixing all crashes, I hope someone can confirm this.
https://bugs.archlinux.org/task/43986

Revision history for this message
Nuno Carvalho (rekconk) wrote :

Hi Timo,

Any chance 5.4.2 is backported to vivid?
It is good that the bug is fixed on 15.10, but for the last released version (15.04) the bug is still there.

Best regards,
Nuno Carvalho

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Hi Nuno,

Qt 5.4.2 is not just a small bugfix release, so it does not fall under Stable Release Updates guidelines (https://wiki.ubuntu.com/StableReleaseUpdates).

So unfortunately I don't think the bug is going to be fixed there unless someone identifies the exact patches needed to fix the issue without risking regressions elsewhere.

Revision history for this message
Czikus (czikus-gmail) wrote :

Still getting krunner crashes when switching screens on Willy with Qt. 5.4.2.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

FWIW, the screen switching problems are quite spread to a lot of smaller bugs, which explains why Qt 5.4.2 did not fix everything.

For example, these bugs exist in upstream tracker:
https://bugreports.qt.io/browse/QTBUG-46024
https://bugreports.qt.io/browse/QTBUG-42985
https://bugreports.qt.io/browse/QTBUG-47041

A lot of rework to the code in question has happened in Qt 5.5, and now 5.5.1. Qt 5.5.1 is not yet released, but will be targeted to land to Ubuntu after 15.10 release.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

qtbase-opensource-src (5.5.1+dfsg-6ubuntu3) xenial; urgency=medium

  * debian/patches/enable-tests.patch:
    - Replace the non-DFSG-free RFC files with public domain content.
    - Adjust tests to the new files.
    (LP: #1522442)
  * debian/copyright: mention the replacement.
  * Switch to opt-in for architectures to run tests on.

 -- Timo Jyrinki <email address hidden> Mon, 07 Dec 2015 14:02:11 +0000

qtbase-opensource-src (5.5.1+dfsg-6ubuntu2) xenial; urgency=high

  * Skip largefile test on s390x too, in addition to amd64.
  * Make tests to keep going till the end with -k.

 -- Dimitri John Ledkov <email address hidden> Fri, 04 Dec 2015 16:54:28 +0000

qtbase-opensource-src (5.5.1+dfsg-6ubuntu1) xenial; urgency=medium

  * New upstream release. (LP: #1437206) (LP: #1450137) (LP: #1474313)
    (LP: #1470700) (LP: #1504631) (LP: #1423659) (LP: #1474775) (LP: #1508945)
  * Replace load_testability_from_env_var.patch with upstreamed
    Add-environment-variable-support-for-testability-lib.patch
  * Drop patches in upstream:
    - Correct-typo-in-the-Gujarati-openType-identififer.patch
  * Rebase enable-tests.patch. Disable one failing QtWidgets test.
  * Build depend on GStreamer 1.0 and add a configure option for it.
  * Update symbols.
  * Mark/unmark private symbols.
  * Replace two Ubuntu patches with upstreamed patches:
    - Drop disable-generic-plugin-when-others-available.patch, replace with
      Add-an-option-to-skip-the-generic-bearer-engine.patch
    - Drop qopenglframebufferobject_powervrworkaround.patch, replace with
      Blacklist-PowerVR-Rogue-G6200-v1.3-from-supporting-B.patch
  * debian/patches/Make-sure-networkAccessibilityChanged-is-emitted.patch:
    - Include a network fix from Qt 5.5 branch (merged after 5.5.1)
      (LP: #1470700)
  * debian/patches/Use-Node-name-if-Node-logicalModuleName-is-empty-for.patch:
    - Fix a qdoc issue (LP: #1447182)
  * Remove disable_overlay_scrollbars.diff as overlay scrollbars were dropped.
  * debian/patches/Prefer-QT_PLUGIN_PATH-over-compiled-in-paths.patch:
    - Backport. Prefer QT_PLUGIN_PATH over compiled-in paths (LP: #1519927)
  * debian/patches/Fix-crash-on-exit-caused-by-QStringLiterals.patch
    - Backport. Fix a crasher on exit (LP: #1436973)
  * Replace our workaround for font rendering with new backported upstream
    patches:
    - Add debian/patches/Fix-falsely-reported-style-for-fallback-font.patch
    - Add debian/patches/Remove-historical-4-padding-in-QFontEngine-alphaMapF.patch
    - Remove debian/patches/enable_fonts_always_smoothly.patch
      (LP: #1475205)

 -- Timo Jyrinki <email address hidden> Tue, 01 Dec 2015 06:16:35 +0000

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.