Bug 308040 - KWin crashes after restarting it
Summary: KWin crashes after restarting it
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: 4.10
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-07 21:16 UTC by Hrvoje Senjan
Modified: 2013-01-02 18:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.10
thomas.luebking: ReviewRequest+


Attachments
kdebug output (10.92 KB, text/plain)
2012-10-07 22:54 UTC, Hrvoje Senjan
Details
New crash information added by DrKonqi (3.60 KB, text/plain)
2012-12-29 11:39 UTC, Hrvoje Senjan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hrvoje Senjan 2012-10-07 21:16:55 UTC
Application: kwin (4.9.80)
KDE Platform Version: 4.9.80 (Compiled from sources)
Qt Version: 4.8.3
Operating System: Linux 3.4.12-2-desktop x86_64
Distribution: "openSUSE 12.3 Milestone 0 (x86_64)"

-- Information about the crash:
- What I was doing when the application crashed:

Steps to reproduce:
Select one of the themes from kde-look (i could trigger this with most or all aurorae themes) for deco -->
Decorations don't get drawn -->
kwin --replace & -->
crash & decos are now visible

The crash can be reproduced every time.

-- Backtrace:
Application: KWin (kwin), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7ffb616db780 (LWP 24810))]

Thread 3 (Thread 0x7ffb3ffff700 (LWP 24813)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x00007ffb5e186267 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x7ffb5e493640 <QTWTF::pageheap_memory>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#2  0x00007ffb5e186299 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#3  0x00007ffb5c2f4e0f in start_thread (arg=0x7ffb3ffff700) at pthread_create.c:308
#4  0x00007ffb5a2f444d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:114

Thread 2 (Thread 0x7ffb46e11700 (LWP 25066)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:217
#1  0x00007ffb5c58b477 in wait (time=30000, this=0x1816f60) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=<optimized out>, mutex=0x18154d8, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007ffb5c57ec7f in QThreadPoolThread::run (this=0x17d7570) at concurrent/qthreadpool.cpp:141
#4  0x00007ffb5c58afbc in QThreadPrivate::start (arg=0x17d7570) at thread/qthread_unix.cpp:338
#5  0x00007ffb5c2f4e0f in start_thread (arg=0x7ffb46e11700) at pthread_create.c:308
#6  0x00007ffb5a2f444d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:114

Thread 1 (Thread 0x7ffb616db780 (LWP 24810)):
[KCrash Handler]
#6  QRegion::operator+= (this=0x174c7e0, r=...) at painting/qregion.cpp:4090
#7  0x00007ffb6124c287 in KWin::Compositor::addRepaint (this=0x174c780, r=...) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/composite.cpp:466
#8  0x00007ffb611f8e97 in KWin::Client::releaseWindow (this=0x1b72820, on_shutdown=true) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/client.cpp:260
#9  0x00007ffb611e832b in KWin::Workspace::~Workspace (this=0x1855440, __in_chrg=<optimized out>) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/workspace.cpp:490
#10 0x00007ffb611e8a39 in KWin::Workspace::~Workspace (this=0x1855440, __in_chrg=<optimized out>) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/workspace.cpp:524
#11 0x00007ffb61205977 in KWin::Application::lostSelection (this=0x7fff20e42950) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/main.cpp:354
#12 0x00007ffb5c69d38f in QMetaObject::activate (sender=0x7fff20e42968, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3556
#13 0x00007ffb5d3bed13 in KSelectionOwner::filterEvent (this=0x7fff20e42968, ev_P=<optimized out>) at /home/hrvoje/kdesrc/kde/kdelibs/kdeui/util/kmanagerselection.cpp:224
#14 0x00007ffb5d35e3de in publicx11Event (e=<optimized out>, this=<optimized out>) at /home/hrvoje/kdesrc/kde/kdelibs/kdeui/kernel/kapplication.cpp:918
#15 KApplication::x11EventFilter (this=0x174c7e0, _event=0x7fff20e423f0) at /home/hrvoje/kdesrc/kde/kdelibs/kdeui/kernel/kapplication.cpp:930
#16 0x00007ffb5b880afc in qt_x11EventFilter (ev=0x7fff20e423f0) at kernel/qapplication_x11.cpp:435
#17 qt_x11EventFilter (ev=0x7fff20e423f0) at kernel/qapplication_x11.cpp:423
#18 0x00007ffb5b88e0db in QApplication::x11ProcessEvent (this=0x7fff20e42950, event=0x7fff20e423f0) at kernel/qapplication_x11.cpp:3353
#19 0x00007ffb5b8b5889 in QEventDispatcherX11::processEvents (this=0x15e2b20, flags=...) at kernel/qeventdispatcher_x11.cpp:132
#20 0x00007ffb5c68584f in QEventLoop::processEvents (this=this@entry=0x7fff20e42660, flags=...) at kernel/qeventloop.cpp:149
#21 0x00007ffb5c685ad8 in QEventLoop::exec (this=0x7fff20e42660, flags=...) at kernel/qeventloop.cpp:204
#22 0x00007ffb5c68a778 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#23 0x00007ffb61206ac4 in kdemain (argc=2, argv=0x7fff20e42a98) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/main.cpp:545
#24 0x00007ffb5a22f725 in __libc_start_main (main=0x400950 <main(int, char**)>, argc=2, ubp_av=0x7fff20e42a98, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff20e42a88) at libc-start.c:225
#25 0x0000000000400981 in _start () at ../sysdeps/x86_64/start.S:123

Reported using DrKonqi
Comment 1 Thomas Lübking 2012-10-07 22:38:46 UTC
> Application: kwin (4.9.80)
Hah?
I've git master but kwin --version says:

Qt: 4.8.3
KDE Development Platform: 4.9.2
KWin: 4.9.1

-> what version (git commit hash?) is that actually?

> #11 0x00007ffb61205977 in KWin::Application::lostSelection (this=0x7fff20e42950) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/main.cpp:354

-> KWin exits because some other WM is started -> sounds like a follow up crash. Do you have the backtrace from the instance that runs (and crashes?) when you install a deco?
Comment 2 Hrvoje Senjan 2012-10-07 22:53:00 UTC
(In reply to comment #1)
> > Application: kwin (4.9.80)
> Hah?
> I've git master but kwin --version says:
> 
> Qt: 4.8.3
> KDE Development Platform: 4.9.2
> KWin: 4.9.1
> 
> -> what version (git commit hash?) is that actually?
kwin --version
Qt: 4.8.3
KDE Development Platform: 4.9.80
KWin: 4.9.80

Last commit is 2c1c8, 'Fix build error when GLES is not available'

> > #11 0x00007ffb61205977 in KWin::Application::lostSelection (this=0x7fff20e42950) at /home/hrvoje/kdesrc/kde/kde-workspace/kwin/main.cpp:354
> 
> -> KWin exits because some other WM is started -> sounds like a follow up
> crash. Do you have the backtrace from the instance that runs (and crashes?)
> when you install a deco?

I can't reproduce the issue as clear after i logged out. However i can reproduce crash every time when using oxygen decos (the ones from kdeartwork/ but who would want do use those :-) )

Gonna attach kdebug output when runnng kwin --replace. There's no other WM running, except kwin :-)
Comment 3 Hrvoje Senjan 2012-10-07 22:54:08 UTC
Created attachment 74399 [details]
kdebug output
Comment 4 Thomas Lübking 2012-10-07 23:09:21 UTC
(In reply to comment #2)

> I can't reproduce the issue as clear after i logged out. However i can
> reproduce crash every time when using oxygen decos (the ones from
> kdeartwork/ but who would want do use those :-) )
Could you please elaborate on that? There's only one oxygen decoration (and oxygen-transparent, but that's not exaclty oxygen either)

Also whyt do you mean by "using", you set oxygen as decoration and then load an aurorae theme via GHNS (into the local storage, not even actually using it) and then get a crash with that backtrace (which says "kwin currently shuts down")?
Comment 5 Hrvoje Senjan 2012-10-08 13:44:05 UTC
(In reply to comment #4)
> Could you please elaborate on that? There's only one oxygen decoration (and
> oxygen-transparent, but that's not exaclty oxygen either)
This is the one:
http://websvn.kde.org/trunk/KDE/kdeartwork/aurorae/Oxygen/

> Also whyt do you mean by "using", you set oxygen as decoration and then load
> an aurorae theme via GHNS (into the local storage, not even actually using
> it) and then get a crash with that backtrace (which says "kwin currently
> shuts down")?

1) Load deco
2) Restart kwin
3) restart it again
4) crash
Note that steps 2 & 3 were only done cause deco's didn't get drawn, now that they are, those steps are done only to trigger the crash. Crash itself happens either (sometimes) after a first restart, and always after the second one.
Once it crashes, you can get after every kwin restart (every other restart triggers a crash, you even don't have to change the deco). 
Then, if you change the deco back to kde-workspace's oxygen, restart kwin you get one more crash, but then all the next restarts of kwin don't cause it to crash.
Comment 6 Thomas Lübking 2012-10-08 19:01:51 UTC
Ok, the bottom line here is that kwin crashes on "kwin --replace&" and that might loosely be tied to the used decoration?
(i've actually recently observed occasional restart crashes myself; using bespin, though. sometimes needed up to 5 attempts to get it running)
Comment 7 Hrvoje Senjan 2012-10-08 19:08:34 UTC
(In reply to comment #6)
> Ok, the bottom line here is that kwin crashes on "kwin --replace&" and that
> might loosely be tied to the used decoration?
Yes. 
Sorry if the title is confusing, i'm not a native english speaker, so i can't express exactly what i mean
Comment 8 Martin Flöser 2012-12-29 09:17:46 UTC
are you still able to reproduce?
Comment 9 Thomas Lübking 2012-12-29 11:29:46 UTC
For bespin the reason was that it used to trigger a refonfigure via dbus to fix borders with compositor changes (1px cosmetic border for an outline, atm. needs deco reconstruction - i'd have altered the API for 4.10, but fear ubuntu ;-) what caused trouble with the threaded startup.
Delaying those calls (by a second) mostly fixed it (but for some systems on session starts)

It's not happened ever since then, but acquiring the dbus service from kuniqueapplicatin via --replace fails every other time (what means all the time, since every other time, there's simply no conflicting service)
Comment 10 Hrvoje Senjan 2012-12-29 11:39:26 UTC
Created attachment 76077 [details]
New crash information added by DrKonqi

kwin (4.10.60 "release 11") on KDE Platform 4.10.60 "release 11" using Qt 4.8.5

- What I was doing when the application crashed:

Looks like i'm still able to reproduce it, in a same way as originally reported.
Backtrace looks *slightly* different, so i'm sending it ;-)

-- Backtrace (Reduced):
#6  KWin::Compositor::setCompositeTimer (this=0xbcf000) at /usr/src/debug/kde-workspace-git/kwin/composite.cpp:643
#7  0x00007f0d857afb17 in KWin::Client::releaseWindow (this=0xc0a540, on_shutdown=true) at /usr/src/debug/kde-workspace-git/kwin/client.cpp:269
#8  0x00007f0d8579fc73 in KWin::Workspace::~Workspace (this=0xa34520, __in_chrg=<optimized out>) at /usr/src/debug/kde-workspace-git/kwin/workspace.cpp:530
#9  0x00007f0d857a0399 in KWin::Workspace::~Workspace (this=0xa34520, __in_chrg=<optimized out>) at /usr/src/debug/kde-workspace-git/kwin/workspace.cpp:564
#10 0x00007f0d857bdfa7 in KWin::Application::lostSelection (this=0x7fffa6c7d830) at /usr/src/debug/kde-workspace-git/kwin/main.cpp:354
Comment 11 Thomas Lübking 2012-12-29 15:57:56 UTC
Problem is likely that moc deleted s_compositor (from workspace parent) before the client is released, but the Compositor deconstructor does not NULL s_compositor.

Can you try a patch?
Comment 12 Hrvoje Senjan 2012-12-29 16:04:44 UTC
(In reply to comment #11)
> Can you try a patch?

Sure ;-)
Comment 13 Thomas Lübking 2012-12-29 16:10:58 UTC
Splendid.
Please see https://git.reviewboard.kde.org/r/108007/
Comment 14 Hrvoje Senjan 2012-12-29 17:06:41 UTC
(In reply to comment #13)
> Splendid.
> Please see https://git.reviewboard.kde.org/r/108007/

Seems that did it :-) No more crashes after changing decos and doing a restart(s) of KWin 
Thanks!
Comment 15 Thomas Lübking 2012-12-29 17:16:42 UTC
Thanks for the info.
Comment 16 Thomas Lübking 2013-01-02 18:00:16 UTC
Git commit 5e834f708d72262e4af58b3baa0e63f8a95a0cfd by Thomas Lübking.
Committed on 29/12/2012 at 17:01.
Pushed by luebking into branch 'KDE/4.10'.

NULL Compositor global static on deletion

what moc can do any time for the Workspace deconstructor
FIXED-IN: 4.10
REVIEW: 108007

M  +1    -0    kwin/composite.cpp

http://commits.kde.org/kde-workspace/5e834f708d72262e4af58b3baa0e63f8a95a0cfd
Comment 17 Thomas Lübking 2013-01-02 18:06:42 UTC
Git commit 1fefaa9e1e7f6c53c5dca283f12653432d6130cb by Thomas Lübking.
Committed on 29/12/2012 at 17:01.
Pushed by luebking into branch 'master'.

NULL Compositor global static on deletion

what moc can do any time for the Workspace deconstructor
FIXED-IN: 4.10
REVIEW: 108007

M  +1    -0    kwin/composite.cpp

http://commits.kde.org/kde-workspace/1fefaa9e1e7f6c53c5dca283f12653432d6130cb