kdelibs race condition

Kleag kleag at free.fr
Sun Dec 2 10:26:44 GMT 2007


Hello,

I have a problem building a fresh kde4 (I removed src, buid, dist and config 
directories). It freezes a soon as it tries to use a newly built kde4 binary 
(in this case meinproc4). Looking with gdb (see below), it seems that there 
is a race condition in the initilaizations of kdebug and kconfig.

Commenting out debug messages in kconfigini seems to solve the problem, but 
I'm not sure that removing these warnings is the proper solution. I put below 
the resulting patch.

What's your idea ?

Regards,

Kleag

Index: kdecore/config/kconfigini.cpp
===================================================================
--- kdecore/config/kconfigini.cpp       (révision 743893)
+++ kdecore/config/kconfigini.cpp       (copie de travail)
@@ -33,13 +33,13 @@
 #include <ksavefile.h>
 #include <kde_file.h>
 #include "kstandarddirs.h"
-#include <kdebug.h>
+// #include <kdebug.h>

 #include <qdatetime.h>
 #include <qdir.h>
 #include <qfile.h>
 #include <qfileinfo.h>
-#include <qdebug.h>
+// #include <qdebug.h>
 #include <qmetaobject.h>
 #include <qregexp.h>

@@ -107,7 +107,7 @@
                 end = start;
                 for (;;) {
                     if (end == line.length()) {
-                        kWarning() << warningProlog(file, lineNo) << "Invalid 
group header.";
+//                         kWarning() << warningProlog(file, lineNo) 
<< "Invalid group header.";
                         // XXX maybe reset the current group here?
                         goto next_line;
                     }
@@ -148,11 +148,11 @@

             if (end == -1 && !line.contains("[$d]")) {
                 // no equals sign
-                kWarning() << warningProlog(file, lineNo) << "Invalid entry 
(missing '=')" << endl;
+//                 kWarning() << warningProlog(file, lineNo) << "Invalid 
entry (missing '=')" << endl;
                 continue;
             } else if (end == 1) {
                 // empty key
-                kWarning() << warningProlog(file, lineNo) << "Invalid entry 
(empty key)" << endl;
+//                 kWarning() << warningProlog(file, lineNo) << "Invalid 
entry (empty key)" << endl;
                 continue;
             }
             QByteArray aKey = line.left(end);
@@ -172,12 +172,12 @@
                 int start = aKey.indexOf('[');
                 end = aKey.indexOf(']', start);
                 if (start != -1 && end == -1) {
-                    kWarning() << warningProlog(file, lineNo)
-                            << "Invalid entry (missing ']')" << endl;
+//                     kWarning() << warningProlog(file, lineNo)
+//                             << "Invalid entry (missing ']')" << endl;
                     continue;
                 } else if (end < start) {
-                    kWarning() << warningProlog(file, lineNo)
-                            << "Invalid entry (unmatched ']')" << endl;
+//                     kWarning() << warningProlog(file, lineNo)
+//                             << "Invalid entry (unmatched ']')" << endl;
                     continue;
                 }else if (aKey.at(start+1) == '$') { // found option(s)
                     int i = start+2;
@@ -203,8 +203,8 @@
                     }
                 } else { // found a locale
                     if (!locale.isNull()) {
-                        kWarning() << warningProlog(file, lineNo)
-                                << "Invalid entry (second locale!?)" << endl;
+//                         kWarning() << warningProlog(file, lineNo)
+//                                 << "Invalid entry (second locale!?)" << 
endl;
                         continue;
                     }

@@ -622,8 +622,8 @@
         } else {
             QByteArray e(str, 2);
             e.prepend("\\x");
-            kWarning() << warningProlog(file, line) << "Invalid hex 
character " << c
-                    << " in \\x<nn>-type escape sequence \"" << e.constData() 
<< "\"." << endl;
+//             kWarning() << warningProlog(file, line) << "Invalid hex 
character " << c
+//                     << " in \\x<nn>-type escape sequence \"" << 
e.constData() << "\"." << endl;
             return 'x';
         }
     }
@@ -690,8 +690,8 @@
                     break;
                 default:
                     *r = '\\';
-                    kWarning() << warningProlog(file, line)
-                            << QString("Invalid escape sequence 
\"\\%1\".").arg(str[i]) << endl;
+//                     kWarning() << warningProlog(file, line)
+//                             << QString("Invalid escape sequence 
\"\\%1\".").arg(str[i]) << endl;
             }
         }
     }



#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7bc8206 in pthread_cond_wait@@GLIBC_2.3.2 () 
from /lib/i686/libpthread.so.0
#2  0xb7c145b5 in QMutexPrivate::wait (this=0x8066f88, timeout=-1)
    at /opt/kde4/kdesvn/qt-copy/src/corelib/thread/qmutex_unix.cpp:78
#3  0xb7c11145 in QMutex::lock (this=0x8066df8)
    at /opt/kde4/kdesvn/qt-copy/src/corelib/thread/qmutex.cpp:213
#4  0xb7a6021c in kDebugStream (level=QtWarningMsg, area=0,
    file=0xb7ba1ac0 "/opt/kde4/kdesvn/kdelibs/kdecore/config/kconfigini.cpp", 
line=151,
    funcinfo=0xb7ba1da0 "KConfigBackend::ParseInfo 
KConfigIniBackend::parseConfig(const QByteArray&, KEntryMap&, 
QFlags<KConfigBackend::ParseOption>, bool)")
    at /opt/kde4/kdesvn/qt-copy/src/corelib/thread/qmutex.h:109
#5  0xb7a2362b in KConfigIniBackend::parseConfig (this=0x8067470,
    currentLocale=@0xbfe68164, entryMap=@0xbfe68144, options=@0xbfe680b4, 
merging=false)
    at /opt/kde4/kdesvn/kdelibs/kdecore/io/kdebug.h:214
#6  0xb7a24ac6 in KConfigIniBackend::parseConfig (this=0x8067470,
    currentLocale=@0xbfe68164, entryMap=@0xbfe68144, options=@0xbfe68168)
    at /opt/kde4/kdesvn/kdelibs/kdecore/config/kconfigini.cpp:67
#7  0xb7a0b0fc in KConfigPrivate (this=0x8066e68, componentData_=@0x8060ad0,
    flags=@0xbfe681d8, resource=0xb7ba0ef0 "config")
    at /opt/kde4/kdesvn/kdelibs/kdecore/config/kconfig.cpp:83
#8  0xb7a0c53b in KConfig (this=0x8066cc0, file=@0xbfe682d0, mode=@0xbfe682cc,
    resourceType=0xb7ba0ef0 "config")
    at /opt/kde4/kdesvn/kdelibs/kdecore/config/kconfig.cpp:118
#9  0xb7a61d13 in KDebugPrivate::areaData (this=0x8066df8, type=QtWarningMsg, 
num=0)
    at /opt/kde4/kdesvn/kdelibs/kdecore/io/kdebug.cpp:358
#10 0xb7a62e9d in KDebugPrivate::stream (this=0x8066df8, type=QtWarningMsg, 
area=0,
    
debugFile=0xb7ba1ac0 "/opt/kde4/kdesvn/kdelibs/kdecore/config/kconfigini.cpp",
    line=151,
    funcinfo=0xb7ba1da0 "KConfigBackend::ParseInfo 
KConfigIniBackend::parseConfig(const QByteArray&, KEntryMap&, 
QFlags<KConfigBackend::ParseOption>, bool)")
    at /opt/kde4/kdesvn/kdelibs/kdecore/io/kdebug.cpp:514
#11 0xb7a601dd in kDebugStream (level=QtWarningMsg, area=0,
    file=0xb7ba1ac0 "/opt/kde4/kdesvn/kdelibs/kdecore/config/kconfigini.cpp", 
line=151,
    funcinfo=0xb7ba1da0 "KConfigBackend::ParseInfo 
KConfigIniBackend::parseConfig(const QByteArray&, KEntryMap&, 
QFlags<KConfigBackend::ParseOption>, bool)")
    at /opt/kde4/kdesvn/kdelibs/kdecore/io/kdebug.cpp:608
#12 0xb7a2362b in KConfigIniBackend::parseConfig (this=0x8060e30,
    currentLocale=@0xbfe686d4, entryMap=@0xbfe686b4, options=@0xbfe68624, 
merging=false)
    at /opt/kde4/kdesvn/kdelibs/kdecore/io/kdebug.h:214
#13 0xb7a24ac6 in KConfigIniBackend::parseConfig (this=0x8060e30,
    currentLocale=@0xbfe686d4, entryMap=@0xbfe686b4, options=@0xbfe686d8)
    at /opt/kde4/kdesvn/kdelibs/kdecore/config/kconfigini.cpp:67
#14 0xb7a0b0fc in KConfigPrivate (this=0x8062178, componentData_=@0x8060ad0,
    flags=@0xbfe68748, resource=0xb7ba0ef0 "config")
    at /opt/kde4/kdesvn/kdelibs/kdecore/config/kconfig.cpp:83

-- 
KsirK - a turn-based strategy game for KDE
http://gna.org/projects/ksirk

KGraphViewer - a GraphViz dot graphs viewer
http://extragear.kde.org/apps/kgraphviewer




More information about the kde-core-devel mailing list