Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 450818 - x11-libs/qt-core-4.8.4: QDeclarativeVMEMetaObject::metaCall SIGSEGV when called from QMetaObject::metaCall
Summary: x11-libs/qt-core-4.8.4: QDeclarativeVMEMetaObject::metaCall SIGSEGV when call...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: AMD64 Linux
: Normal major with 1 vote (vote)
Assignee: Qt Bug Alias
URL: https://codereview.qt-project.org/46228
Whiteboard:
Keywords: InVCS, PATCH, UPSTREAM
: 456034 456130 456252 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-08 12:13 UTC by David E. Narváez
Modified: 2013-03-18 19:53 UTC (History)
36 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Revert the offending commit (plasma-workspace.patch,5.47 KB, patch)
2013-01-08 12:15 UTC, David E. Narváez
Details | Diff
Revert offending commit (complete) (plasma-workspace.patch,6.66 KB, patch)
2013-01-08 13:54 UTC, David E. Narváez
Details | Diff
Proposal for a qt-core revbump (qt-core-4.8.4-r2.diff,6.01 KB, patch)
2013-01-12 13:21 UTC, David E. Narváez
Details | Diff
Proposed patch for qt-core (metacall-crash-fix.patch,945 bytes, patch)
2013-02-09 21:38 UTC, Jakob Kummerow
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David E. Narváez 2013-01-08 12:13:10 UTC
See upstream bug for a full description.

Reproducible: Always
Comment 1 Michael Palimaka (kensington) gentoo-dev 2013-01-08 12:15:13 UTC
@qt, there was some thought that this may be a Qt issue.
Comment 2 David E. Narváez 2013-01-08 12:15:33 UTC
Created attachment 334784 [details, diff]
Revert the offending commit

Adding an arch specific hacky patch to work around the issue at least temporarily
Comment 3 David E. Narváez 2013-01-08 13:54:24 UTC
Created attachment 334798 [details, diff]
Revert offending commit (complete)

Sorry, just noticed my previous patch was incomplete.
Comment 4 David E. Narváez 2013-01-12 13:21:58 UTC
Created attachment 335314 [details, diff]
Proposal for a qt-core revbump

This turns out to be a Qt bug, see https://bugreports.qt-project.org/browse/QTBUG-29082

The attached patch revbumps qt-core to include a patch to workaround the issue by avoiding the problematic code path in QPropertyAnimation.
Comment 5 Davide Pesavento gentoo-dev 2013-01-15 00:52:21 UTC
(In reply to comment #4)

Where does that patch come from? Has it been submitted upstream?
Comment 6 David E. Narváez 2013-01-17 20:14:28 UTC
(In reply to comment #5)
> Where does that patch come from? Has it been submitted upstream?

Sorry for the late reply, didn't get the notification.

The patch is mine but there's no comment from upstream about a general fix yet.
Comment 7 Davide Pesavento gentoo-dev 2013-01-17 21:37:37 UTC
Well the patch has to be submitted to gerrit (https://codereview.qt-project.org) to be properly reviewed, upstream stopped caring about patches in bugreports a long time ago.
Comment 8 Davide Pesavento gentoo-dev 2013-01-26 10:53:03 UTC
(In reply to comment #7)
> Well the patch has to be submitted to gerrit
> (https://codereview.qt-project.org) to be properly reviewed, upstream
> stopped caring about patches in bugreports a long time ago.

ping?
Comment 9 David E. Narváez 2013-01-30 18:25:36 UTC
Added a code review

https://codereview.qt-project.org/46228
Comment 10 Bernd Buschinski 2013-01-31 14:14:02 UTC
kde 4.10 is very near... I hope qt-core revbump with patch will happen very soon,
if you don't want several hundreds duplicate bugreports
Comment 11 Erik Zeek 2013-02-07 14:21:35 UTC
I just hit this after upgrading to kde 4.10.  Can this patch be applied soon?
Comment 12 Michael Palimaka (kensington) gentoo-dev 2013-02-07 15:48:26 UTC
This is causing crashes in kde-base/plasma-workspace-4.10.0. If anyone has anything further to add to the comments on the code review, please add them.
Comment 13 Michael Palimaka (kensington) gentoo-dev 2013-02-07 15:48:47 UTC
*** Bug 456034 has been marked as a duplicate of this bug. ***
Comment 14 Andreas K. Hüttel archtester gentoo-dev 2013-02-07 22:20:34 UTC
As a workaround (which may have unintended consequences, no idea) you can try upgrading to kde-base/plasma-workspace-4.10.0-r1 (kde overlay). This should not trigger the relevant codepath anymore.
Comment 15 Reuben Martin 2013-02-08 05:50:44 UTC
I have a related issue with qt-core. I applied this patch, but it didn't fix the problem for me. I changed the optimization flags from -O2 to -Os and that fixed the issue.

The -Os fix was mentioned in a bug that was marked a duplicate of this one upstream. I would open this as a separate bug if this wasn't the case. Not sure if the two issues are actually related.
Comment 16 Ben de Groot (RETIRED) gentoo-dev 2013-02-08 07:57:46 UTC
It doesn't look like Qt upstream likes this patch, so we need a better solution.
Comment 17 Grzegorz Kowal 2013-02-08 08:41:21 UTC
(In reply to comment #14)
> As a workaround (which may have unintended consequences, no idea) you can
> try upgrading to kde-base/plasma-workspace-4.10.0-r1 (kde overlay). This
> should not trigger the relevant codepath anymore.

The proposed patch for kde-base/plasma-workspace-4.10.0-r1 solves the plasma-desktop crash, but then plasma-desktop eats 100% of CPU on my system.

Only the recompilation of qt-code with -Os instead of -O2 solved both problems for me.
Comment 18 Mark 2013-02-08 09:39:18 UTC
I confirm that compiling qt-core with -Os instead of -O2 resolves the problem. So this rather looks like a compiler bug.

The kde 4.10 release is affected by that (https://bugs.kde.org/show_bug.cgi?id=314610) but KDE bugzilla closed the problem because it is not a kde problem.
The only solutions so far seem to be masking kde 4.10 or change -O2 CXXFLAGS in qt-core or bomb the affected kde/qt codepieces with volatile keywords (they are casting stuff around and maybe the compiler interferes with that) or redesign whatever caused the problem.

It is like a running gag: KDE releases a "stable" version that immediately crashes like nobody ever tested it once for five minutes.
Comment 19 Patrick 2013-02-08 10:18:10 UTC
(In reply to comment #14)
> As a workaround (which may have unintended consequences, no idea) you can
> try upgrading to kde-base/plasma-workspace-4.10.0-r1 (kde overlay). This
> should not trigger the relevant codepath anymore.

Now plasma-workspace works again, but after a few minutes, plasma-desktop is constantly hogging one core. My power station operator likes it ;)
Comment 20 Michael Palimaka (kensington) gentoo-dev 2013-02-08 12:38:55 UTC
*** Bug 456130 has been marked as a duplicate of this bug. ***
Comment 21 Dale 2013-02-08 20:26:56 UTC
Same problem here.  amd64  Tried x11-libs/qt-core-4.8.4-r1 but no change.  If someone wants more info that will help, let me know.
Comment 22 Andreas K. Hüttel archtester gentoo-dev 2013-02-08 20:33:42 UTC
(In reply to comment #17)
> (In reply to comment #14)
> > As a workaround (which may have unintended consequences, no idea) you can
> > try upgrading to kde-base/plasma-workspace-4.10.0-r1 (kde overlay). This
> > should not trigger the relevant codepath anymore.
> 
> The proposed patch for kde-base/plasma-workspace-4.10.0-r1 solves the
> plasma-desktop crash, but then plasma-desktop eats 100% of CPU on my system.
> 
> Only the recompilation of qt-code with -Os instead of -O2 solved both
> problems for me.

OK... added the patch anyway, it's better than full crash. We still need to solve this otherwise though.
Comment 23 David E. Narváez 2013-02-08 21:24:27 UTC
(In reply to comment #15)
> I have a related issue with qt-core. I applied this patch, but it didn't fix
> the problem for me. I changed the optimization flags from -O2 to -Os and
> that fixed the issue.

What patch did you apply that didn't solve the issue? The patch in plasma-desktop-4.10-r1?
Comment 24 David E. Narváez 2013-02-08 21:40:06 UTC
(In reply to comment #18)
> I confirm that compiling qt-core with -Os instead of -O2 resolves the
> problem. So this rather looks like a compiler bug.

Qt's code has an invalid read, there's no compiler bug here. Changing the -O flags just hides the problem away, but it is an invalid read in amd64, x86 and any other platform out there.

> The kde 4.10 release is affected by that
> (https://bugs.kde.org/show_bug.cgi?id=314610) but KDE bugzilla closed the
> problem because it is not a kde problem.
> The only solutions so far seem to be masking kde 4.10 or change -O2 CXXFLAGS
> in qt-core or bomb the affected kde/qt codepieces with volatile keywords
> (they are casting stuff around and maybe the compiler interferes with that)
> or redesign whatever caused the problem.

Invalid reads are... invalid. There's nothing to interfere with.

> It is like a running gag: KDE releases a "stable" version that immediately
> crashes like nobody ever tested it once for five minutes.

It probably took me more than five minutes to debug the issue, open bug reports, prepare patches, call for a code review, alert packagers... While the quality process definitely failed here (badly) it is far from the situation you describe above.
Comment 25 Mark Gannon 2013-02-08 22:45:21 UTC
I successfully emerged plasma-workspace-4.10.0-r1 and it resolved the segmentation fault.  I'm not seeing any unusual CPU usage, but my CFLAGS (-O2 -march=native -pipe -ggdb) included debuging that persumable pre-empts the optimization flag.

Thanks for the quick work!
Comment 26 Andrey Grozin gentoo-dev 2013-02-09 16:22:34 UTC
*** Bug 456252 has been marked as a duplicate of this bug. ***
Comment 27 Jakob Kummerow 2013-02-09 21:38:35 UTC
Created attachment 338438 [details, diff]
Proposed patch for qt-core

I have what I believe is a proper patch for this issue.

Looking at the implementation as well as other call sites of QMetaObject::metacall, it seems that function requires an array of arguments as its last parameter. This patch fixes the call site in QPropertyAnimationPrivate::updateProperty to create and pass such an array, just as other call sites (e.g. in QDeclarativePropertyPrivate::writeEnumProperty) do.

Warned by dilfridge's blog post, I've created this patch before updating to KDE 4.10. Interestingly, even without applying it (and with the unpatched plasma-workspace-4.10.0 installed), I haven't observed any crashes; so I'd appreciate someone who was/is seeing crashes applying it and reporting back (just put it in /etc/portage/patches/x11-libs/qt-core-4.8.4-r2/foo.patch and re-emerge qt-core). What I can say with certainty is that it applies fine, compiles fine, and KDE 4.10 runs fine afterwards.

I'd be happy if someone who already has a Qt checkout and contributor account submitted this patch upstream for code review, saving me the trouble to do so ;-)
Comment 28 Bartosz Brachaczek 2013-02-10 00:01:01 UTC
(In reply to comment #27)
After some digging through Qt code, this patch actually looks correct to me too. I'd only not delete the comment and not change constData() to data().
Comment 29 Mark Gannon 2013-02-10 00:09:53 UTC
(In reply to comment #27)
> I'd
> appreciate someone who was/is seeing crashes applying it and reporting back
> (just put it in /etc/portage/patches/x11-libs/qt-core-4.8.4-r2/foo.patch and
> re-emerge qt-core). 

I masked plasma-workspace-4.10.0-r1 and emerged the original version to make sure I could still make the crash happen.  I then followed the instructions to apply the patch and emerged qt-core.  With the patch installed the crash no longer occurs and everything else appears to function correctly.
Comment 30 Davide Pesavento gentoo-dev 2013-02-10 00:35:13 UTC
(In reply to comment #27)
> Created attachment 338438 [details, diff] [details, diff]
> Proposed patch for qt-core
> 

David E. Narváez already submitted a very similar patch to gerrit a few hours ago. We're waiting for review from upstream devs.
Comment 31 Andre Reinke 2013-02-10 10:14:51 UTC
x11-libs/qt-core-4.8.4-r2

installed with 

CFLAGS="-Os -pipe -march=native"
CXXFLAGS="${CFLAGS}"

(see the -Os !)

and 

kde-base/plasma-workspace-4.10.0

installed with my usual settings CFLAGS="-O2 -pipe -march=native"


Everything's fine again. I won't update for a few weeks now. =)
Comment 32 Marek 2013-02-10 18:36:16 UTC
(In reply to comment #31)
> x11-libs/qt-core-4.8.4-r2
> 
> installed with 
> 
> CFLAGS="-Os -pipe -march=native"
> CXXFLAGS="${CFLAGS}"
> 
> (see the -Os !)
> 
> and 
> 
> kde-base/plasma-workspace-4.10.0
> 
> installed with my usual settings CFLAGS="-O2 -pipe -march=native"
> 
> 
> Everything's fine again. I won't update for a few weeks now. =)

ACCEPT_KEYWORDS="~amd64"
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=corei7 -O2 -pipe"
CXXFLAGS="-march=corei7 -O2 -pipe"

Installed all packages with above make.conf settings, including:
x11-libs/qt-core-4.8.4-r1
kde-base/plasma-workspace-4.10.0

I ran KDE after removing ~/.kde4. No crashes. I added another system tray to the desktop for a total of 2. Still, no crashes.
Comment 33 Vasilis Lourdas 2013-02-10 18:40:46 UTC
(In reply to comment #32)
> ACCEPT_KEYWORDS="~amd64"
> CHOST="x86_64-pc-linux-gnu"
> CFLAGS="-march=corei7 -O2 -pipe"
> CXXFLAGS="-march=corei7 -O2 -pipe"
> 
> Installed all packages with above make.conf settings, including:
> x11-libs/qt-core-4.8.4-r1
> kde-base/plasma-workspace-4.10.0
> 
> I ran KDE after removing ~/.kde4. No crashes. I added another system tray to
> the desktop for a total of 2. Still, no crashes.

There are newer versions from the packages you mention. qt-core-4.8.4-r1 does not exist in the tree anymore and there's also plasma-workspace-4.10.0-r1 which contains patches that are supposed to fix the problem, but they don't.

For me, the (temporary) solution was to compile qt-core with -Os and downgrade to plasma-workspace-4.10.0 (mask -r1) to make this work.
Comment 34 Marek 2013-02-10 19:07:44 UTC
(In reply to comment #33)
> There are newer versions from the packages you mention. qt-core-4.8.4-r1
> does not exist in the tree anymore and there's also
> plasma-workspace-4.10.0-r1 which contains patches that are supposed to fix
> the problem, but they don't.
> 
> For me, the (temporary) solution was to compile qt-core with -Os and
> downgrade to plasma-workspace-4.10.0 (mask -r1) to make this work.

This is the point I was trying to make. I have the versions installed with which the problem is supposed to occur, but doesn't.

I'll be masking the new -r2 and -r1 respectively in case the fixes break it for me.
Comment 35 Andre Reinke 2013-02-10 19:22:54 UTC
It still is a qt bug. Dunno why we're hacking around with plasma-workspace instead since the bug is already indentified. :/
Comment 36 Thomas Capricelli 2013-02-10 22:30:20 UTC
(In reply to comment #32 and #34)

Do you use gcc 4.7 ? It seems the bug doesn't show with such a recent gcc.

(note: gcc 4.7 is currently hard-masked)
Comment 37 Andreas K. Hüttel archtester gentoo-dev 2013-02-10 22:34:20 UTC
(In reply to comment #35)
> It still is a qt bug. Dunno why we're hacking around with plasma-workspace
> instead since the bug is already indentified. :/

Because it's less risky to (try to) provide a workaround in an application than to meddle with a library that is used by a few hundred binaries on your system. I would be very happy if someone wrote a workaround for plasma-workspace that just does not trigger the bug anymore *as a workaround*.

That being said, a bugfix for Qt is being developed.
Comment 38 Marek 2013-02-11 02:25:48 UTC
(In reply to comment #36)
> (In reply to comment #32 and #34)
> 
> Do you use gcc 4.7 ? It seems the bug doesn't show with such a recent gcc.
> 
> (note: gcc 4.7 is currently hard-masked)

Indeed I am. I'm running 4.7.2 as per gcc-config.
Comment 39 Davide Pesavento gentoo-dev 2013-02-13 10:09:21 UTC
Fixed in 4.8.4-r3.

Thanks a lot to everyone involved, especially to David E. Narváez for writing the patch and submitting it upstream.
Comment 40 Dennis Schridde 2013-02-13 20:21:06 UTC
(In reply to comment #39)
> Fixed in 4.8.4-r3.

I think someone needs to revert this, right?

*plasma-workspace-4.10.0-r1 (08 Feb 2013)

  08 Feb 2013; Andreas K. Huettel <dilfridge@gentoo.org>
  +plasma-workspace-4.10.0-r1.ebuild,
  +files/plasma-workspace-4.10.0-norepeater.patch:
  Add workaround patch for plasma-workspace crash, see bug 450818 and kde bug
  311751 comments 2 and 32.
Comment 41 Vasilis Lourdas 2013-02-13 20:24:04 UTC
(In reply to comment #40)
> (In reply to comment #39)
> > Fixed in 4.8.4-r3.
> 
> I think someone needs to revert this, right?
> 
> *plasma-workspace-4.10.0-r1 (08 Feb 2013)
> 
>   08 Feb 2013; Andreas K. Huettel <dilfridge@gentoo.org>
>   +plasma-workspace-4.10.0-r1.ebuild,
>   +files/plasma-workspace-4.10.0-norepeater.patch:
>   Add workaround patch for plasma-workspace crash, see bug 450818 and kde bug
>   311751 comments 2 and 32.

Is this the cause of plasma-desktop topping one cpu core? I will mask this version and try again.
Comment 42 Andreas K. Hüttel archtester gentoo-dev 2013-02-13 20:59:15 UTC
(In reply to comment #41)
> (In reply to comment #40)
> > (In reply to comment #39)
> > > Fixed in 4.8.4-r3.
> > 
> > I think someone needs to revert this, right?
> > 
> > *plasma-workspace-4.10.0-r1 (08 Feb 2013)
> > 
> >   08 Feb 2013; Andreas K. Huettel <dilfridge@gentoo.org>
> >   +plasma-workspace-4.10.0-r1.ebuild,
> >   +files/plasma-workspace-4.10.0-norepeater.patch:
> >   Add workaround patch for plasma-workspace crash, see bug 450818 and kde bug
> >   311751 comments 2 and 32.
> 
> Is this the cause of plasma-desktop topping one cpu core? I will mask this
> version and try again.

Yes, and it's gone now. (-r2 = -r0)
Comment 43 Octavian 2013-02-15 17:19:41 UTC
I might be doing something wrong but plasma-desktop still crashes at longin.
I have the following versions:

=kde-base/plasma-workspace-4.10.0-r2
=x11-libs/qt-core-4.8.4-r3
Comment 44 Miroslaw Mieszczak 2013-02-18 09:58:45 UTC
I just compiled kde 4.10 yesterday. And for me it crashes too. But I found the plugin it leading to crash. It is "paste" in the tray. Once activated, the plasma desktop crashes at login.

It is same as mentioned in:
https://bugs.kde.org/show_bug.cgi?id=311751#c59
Comment 45 Octavian 2013-02-20 22:02:14 UTC
(In reply to comment #44)
> I just compiled kde 4.10 yesterday. And for me it crashes too. But I found
> the plugin it leading to crash. It is "paste" in the tray. Once activated,
> the plasma desktop crashes at login.
> 
> It is same as mentioned in:
> https://bugs.kde.org/show_bug.cgi?id=311751#c59

Thanks. That solved my issue.