<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>321164</bug_id>
          
          <creation_ts>2013-06-14 22:57:54 +0000</creation_ts>
          <short_desc>KWin crashes if one changes compositing type fast enough</short_desc>
          <delta_ts>2013-06-26 10:42:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>kwin</product>
          <component>general</component>
          <version>git master</version>
          <rep_platform>openSUSE</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>https://git.reviewboard.kde.org/r/111082/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>drkonqi</keywords>
          <priority>NOR</priority>
          <bug_severity>crash</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Hrvoje Senjan">hrvoje.senjan</reporter>
          <assigned_to name="KWin default assignee">kwin-bugs-null</assigned_to>
          
          
          <cf_commitlink>http://commits.kde.org/kde-workspace/0b0e9ecf9f038a1c438442189a58d4dfb5ca6f96</cf_commitlink>
          <cf_versionfixedin>4.11</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      <flag name="ReviewRequest"
          id="604"
          type_id="14"
          status="+"
          setter="thomas.luebking"
    />

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1376692</commentid>
    <comment_count>0</comment_count>
    <who name="Hrvoje Senjan">hrvoje.senjan</who>
    <bug_when>2013-06-14 22:57:54 +0000</bug_when>
    <thetext>Application: kwin (4.10.80 &quot;release 2&quot;)
KDE Platform Version: 4.10.80 &quot;release 2&quot;
Qt Version: 4.8.5
Operating System: Linux 3.10.0-rc4-3.gfc06ef7-desktop x86_64
Distribution: &quot;openSUSE 13.1 Milestone 2 (x86_64)&quot;

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

As per title. When changing type, or graphicssystem fast enough (via kcm!) in succession, KWin crashes.
I see possible dups, but those are about different settings (though all related to KConfigGroup)
Using master, workspace one commit prior to 4.10.80 tag (but had it also before when checking https://bugs.kde.org/show_bug.cgi?id=179042#c88), kdelibs &amp; co ~at tag

The crash can be reproduced sometimes.

-- Backtrace:
Application: KWin (kwin), signal: Segmentation fault
Using host libthread_db library &quot;/lib64/libthread_db.so.1&quot;.
[Current thread is 1 (Thread 0x7fe3a6fe7780 (LWP 4577))]

Thread 2 (Thread 0x7fe38b388700 (LWP 4578)):
#0  0x00007fe3a05d5d11 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007fe3a0868187 in wait (time=30000, this=0x2100cb0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=&lt;optimized out&gt;, mutex=0x21325b8, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007fe3a085b96f in QThreadPoolThread::run (this=0x2132330) at concurrent/qthreadpool.cpp:141
#4  0x00007fe3a0867ccc in QThreadPrivate::start (arg=0x2132330) at thread/qthread_unix.cpp:338
#5  0x00007fe3a05d1e0e in start_thread () from /lib64/libpthread.so.0
#6  0x00007fe3a67dab9d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fe3a6fe7780 (LWP 4577)):
[KCrash Handler]
#6  0x00007fe3a08696d0 in length (this=0x2022b10) at tools/qbytearray.h:356
#7  qstrcmp (str1=..., str2=...) at tools/qbytearray.cpp:344
#8  0x00007fe3a0fe9a73 in operator&lt; (k2=..., k1=...) at /usr/src/debug/kdelibs-git/kdecore/config/kconfigdata.h:122
#9  qMapLessThanKey&lt;KEntryKey&gt; (key2=..., key1=...) at /usr/include/QtCore/qmap.h:107
#10 findNode (akey=..., this=0x1feeab0) at /usr/include/QtCore/qmap.h:487
#11 find (akey=..., this=0x1feeab0) at /usr/include/QtCore/qmap.h:608
#12 KEntryMap::findEntry (this=0x1feeab0, group=..., key=..., flags=...) at /usr/src/debug/kdelibs-git/kdecore/config/kconfigdata.cpp:78
#13 0x00007fe3a0fe30fa in getEntryOption (option=KEntryMap::EntryImmutable, flags=..., key=..., group=..., this=0x1feeab0) at /usr/src/debug/kdelibs-git/kdecore/config/kconfigdata.h:215
#14 KConfig::isGroupImmutableImpl (this=this@entry=0x1fbbf40, aGroup=...) at /usr/src/debug/kdelibs-git/kdecore/config/kconfig.cpp:744
#15 0x00007fe3a0fe936c in KConfigBase::isGroupImmutable (this=0x1fbbf40, aGroup=...) at /usr/src/debug/kdelibs-git/kdecore/config/kconfigbase.cpp:96
#16 0x00007fe3a0ff01b4 in KConfigGroup::KConfigGroup (this=0x7fffaeca7100, master=0x1fbbf40, _group=...) at /usr/src/debug/kdelibs-git/kdecore/config/kconfiggroup.cpp:468
#17 0x00007fe3a1003519 in KCoreConfigSkeleton::ItemUInt::readConfig (this=0x2022580, config=&lt;optimized out&gt;) at /usr/src/debug/kdelibs-git/kdecore/config/kcoreconfigskeleton.cpp:522
#18 0x00007fe3a100493d in KConfigSkeletonGenericItem&lt;unsigned int&gt;::readDefault (this=0x2022580, config=0x1fbbf40) at /usr/src/debug/kdelibs-git/kdecore/config/kcoreconfigskeleton.h:288
#19 0x00007fe3a1000c25 in KCoreConfigSkeleton::addItem (this=0x7fffaeca7290, item=0x2022580, name=...) at /usr/src/debug/kdelibs-git/kdecore/config/kcoreconfigskeleton.cpp:1113
#20 0x00007fe3a6bdd962 in KWin::Settings::Settings (this=0x7fffaeca7290, config=...) at /usr/src/debug/kde-workspace-git/build/kwin/settings.cpp:363
#21 0x00007fe3a6b2a015 in KWin::Screens::Screens (this=this@entry=0x2132610, parent=&lt;optimized out&gt;) at /usr/src/debug/kde-workspace-git/kwin/screens.cpp:47
#22 0x00007fe3a6b2a079 in KWin::DesktopWidgetScreens::DesktopWidgetScreens (this=0x2132610, parent=&lt;optimized out&gt;) at /usr/src/debug/kde-workspace-git/kwin/screens.cpp:135
#23 0x00007fe3a6b2a109 in KWin::Screens::create (parent=0x20ffb20) at /usr/src/debug/kde-workspace-git/kwin/screens.cpp:33
#24 0x00007fe3a6afd827 in KWin::Workspace::Workspace (this=0x20ffb20, restore=false) at /usr/src/debug/kde-workspace-git/kwin/workspace.cpp:158
#25 0x00007fe3a6b1ba6f in KWin::Application::Application (this=&lt;optimized out&gt;) at /usr/src/debug/kde-workspace-git/kwin/main.cpp:377
#26 0x00007fe3a6b1d3f6 in kdemain (argc=2, argv=0x7fffaeca7f18) at /usr/src/debug/kde-workspace-git/kwin/main.cpp:565
#27 0x00007fe3a6713a15 in __libc_start_main () from /lib64/libc.so.6
#28 0x0000000000400761 in _start () at ../sysdeps/x86_64/start.S:123

Possible duplicates by query: bug 306806, bug 302211.

Reported using DrKonqi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1376693</commentid>
    <comment_count>1</comment_count>
    <who name="Hrvoje Senjan">hrvoje.senjan</who>
    <bug_when>2013-06-14 23:04:01 +0000</bug_when>
    <thetext>Please note that i didn&apos;t benchmark time :-) just tried changing type just about after kwin/plasma settled with the previous one</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1376694</commentid>
    <comment_count>2</comment_count>
    <who name="Thomas Lübking">thomas.luebking</who>
    <bug_when>2013-06-14 23:39:48 +0000</bug_when>
    <thetext>&gt; When changing type, or graphicssystem

Changing the graphicssystem should (necessarily) restart kwin.
Do you get the same crash for that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1376721</commentid>
    <comment_count>3</comment_count>
    <who name="Martin Flöser">mgraesslin</who>
    <bug_when>2013-06-15 07:49:43 +0000</bug_when>
    <thetext>It might be an idea to deactivate the interface while KWin is reconfiguring. In 
fact that could be interesting for all KCMs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1376725</commentid>
    <comment_count>4</comment_count>
    <who name="Thomas Lübking">thomas.luebking</who>
    <bug_when>2013-06-15 08:26:11 +0000</bug_when>
    <thetext>or just schedule reconfig calls inside kwin until all config has finished - should be more robust and long time fix than disabling some guis (to only forget the next one ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1376870</commentid>
    <comment_count>5</comment_count>
    <who name="Hrvoje Senjan">hrvoje.senjan</who>
    <bug_when>2013-06-15 19:27:07 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Changing the graphicssystem should (necessarily) restart kwin.
&gt; Do you get the same crash for that?
So far i couldn&apos;t reproduce if changing only graphicssystem.
Will try to write down which combos/type trigger it most easily/how to trigger it with lowest amount of effort ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1376879</commentid>
    <comment_count>6</comment_count>
    <who name="Thomas Lübking">thomas.luebking</who>
    <bug_when>2013-06-15 19:43:19 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #2)
&gt; &gt; Changing the graphicssystem should (necessarily) restart kwin.
&gt; &gt; Do you get the same crash for that?
&gt; So far i couldn&apos;t reproduce if changing only graphicssystem.
Ok, i wouldn&apos;t have expected it either.

&gt; Will try to write down which combos/type trigger
no need to, we&apos;ll start concurrent reconfigures, that&apos;s all - and KConfigGroup hates any concurrent access ;-)
-&gt; see comment #4 - reconfiguration calls need to be scheduled until any current configration has finished.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1376997</commentid>
    <comment_count>7</comment_count>
    <who name="Martin Flöser">mgraesslin</who>
    <bug_when>2013-06-16 06:38:53 +0000</bug_when>
    <thetext>&gt; no need to, we&apos;ll start concurrent reconfigures, that&apos;s all - and
&gt; KConfigGroup hates any concurrent access ;-)
&gt; -&gt; see comment #4 - reconfiguration calls need to be scheduled until any
&gt; current configration has finished.
That reminds me: the Screens::init() is called before the reading of 
KConfigGroup in another thread finished and can cause issues. At least I hit a 
crash a few times there when other things were broken. Didn&apos;t change yet as I 
couldn&apos;t reproduce when other things were not broken.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1377051</commentid>
    <comment_count>8</comment_count>
      <attachid>80548</attachid>
    <who name="Thomas Lübking">thomas.luebking</who>
    <bug_when>2013-06-16 11:55:40 +0000</bug_when>
    <thetext>Created attachment 80548
Fix?

Ok, as we figured KConfigGroup is not the least threadsafe - this crash is predictable then :(

For the moment Screens::create() will have to move below waitForFinished() as all other config touchers.

@Hrvoje, try to click fast with the attached simple patch ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1377194</commentid>
    <comment_count>9</comment_count>
    <who name="Hrvoje Senjan">hrvoje.senjan</who>
    <bug_when>2013-06-16 21:35:02 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; @Hrvoje, try to click fast with the attached simple patch ;-)
Clicked like mad, some ~15 times, didn&apos;t get a crash :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1377540</commentid>
    <comment_count>10</comment_count>
    <who name="Thomas Lübking">thomas.luebking</who>
    <bug_when>2013-06-17 22:24:39 +0000</bug_when>
    <thetext>Thanks to your rodent for its hard work ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1379501</commentid>
    <comment_count>11</comment_count>
    <who name="Thomas Lübking">thomas.luebking</who>
    <bug_when>2013-06-26 10:42:13 +0000</bug_when>
    <thetext>Git commit 0b0e9ecf9f038a1c438442189a58d4dfb5ca6f96 by Thomas Lübking.
Committed on 16/06/2013 at 11:56.
Pushed by luebking into branch &apos;master&apos;.

move Screens::create post global config reading

It calls KConfigGroup what is not thread safe and
collides with threaded config reading.
FIXED-IN: 4.11
REVIEW: 111082

M  +5    -4    kwin/workspace.cpp

http://commits.kde.org/kde-workspace/0b0e9ecf9f038a1c438442189a58d4dfb5ca6f96</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>80548</attachid>
            <date>2013-06-16 11:55:40 +0000</date>
            <delta_ts>2013-06-16 11:55:40 +0000</delta_ts>
            <desc>Fix?</desc>
            <filename>__try_on_321164.diff</filename>
            <type>text/plain</type>
            <size>1022</size>
            <attacher name="Thomas Lübking">thomas.luebking</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL2t3aW4vd29ya3NwYWNlLmNwcCBiL2t3aW4vd29ya3NwYWNlLmNwcAppbmRl
eCA0M2IzYzVhLi42MWU3OTExIDEwMDY0NAotLS0gYS9rd2luL3dvcmtzcGFjZS5jcHAKKysrIGIv
a3dpbi93b3Jrc3BhY2UuY3BwCkBAIC0xNTQsMTAgKzE1NCw2IEBAIFdvcmtzcGFjZTo6V29ya3Nw
YWNlKGJvb2wgcmVzdG9yZSkKICAgICAvLyBzdGFydCB0aGUgY3Vyc29yIHN1cHBvcnQKICAgICBD
dXJzb3I6OmNyZWF0ZSh0aGlzKTsKIAotICAgIC8vIGdldCBzY3JlZW4gc3VwcG9ydAotICAgIFNj
cmVlbnMgKnNjcmVlbnMgPSBTY3JlZW5zOjpjcmVhdGUodGhpcyk7Ci0gICAgY29ubmVjdChzY3Jl
ZW5zLCBTSUdOQUwoY2hhbmdlZCgpKSwgU0xPVChkZXNrdG9wUmVzaXplZCgpKSk7Ci0KICNpZmRl
ZiBLV0lOX0JVSUxEX0FDVElWSVRJRVMKICAgICBBY3Rpdml0aWVzICphY3Rpdml0aWVzID0gQWN0
aXZpdGllczo6Y3JlYXRlKHRoaXMpOwogICAgIGNvbm5lY3QoYWN0aXZpdGllcywgU0lHTkFMKGN1
cnJlbnRDaGFuZ2VkKFFTdHJpbmcpKSwgU0xPVCh1cGRhdGVDdXJyZW50QWN0aXZpdHkoUVN0cmlu
ZykpKTsKQEAgLTE2NSw2ICsxNjEsMTEgQEAgV29ya3NwYWNlOjpXb3Jrc3BhY2UoYm9vbCByZXN0
b3JlKQogCiAgICAgLy8gUGx1Z2luTWdyIG5lZWRzIGFjY2VzcyB0byB0aGUgY29uZmlnIGZpbGUs
IHNvIHdlIG5lZWQgdG8gd2FpdCBmb3IgaXQgZm9yIGZpbmlzaGluZwogICAgIHJlcGFyc2VDb25m
aWdGdXR1cmUud2FpdEZvckZpbmlzaGVkKCk7CisKKyAgICAvLyBnZXQgc2NyZWVuIHN1cHBvcnQK
KyAgICBTY3JlZW5zICpzY3JlZW5zID0gU2NyZWVuczo6Y3JlYXRlKHRoaXMpOworICAgIGNvbm5l
Y3Qoc2NyZWVucywgU0lHTkFMKGNoYW5nZWQoKSksIFNMT1QoZGVza3RvcFJlc2l6ZWQoKSkpOwor
CiAgICAgb3B0aW9ucy0+bG9hZENvbmZpZygpOwogICAgIG9wdGlvbnMtPmxvYWRDb21wb3NpdGlu
Z0NvbmZpZyhmYWxzZSk7CiAgICAgRGVjb3JhdGlvblBsdWdpbjo6Y3JlYXRlKHRoaXMpOwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>