Bug 153286

Summary: race conditions using kDebug in kconfig
Product: [Frameworks and Libraries] kdelibs Reporter: Gaël de Chalendar (aka Kleag) <kleagg>
Component: kdecoreAssignee: Oswald Buddenhagen <ossi>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: patch changing kWarnings into qWarnings

Description Gaël de Chalendar (aka Kleag) 2007-12-02 16:49:38 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

when 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.

After checking by mail on kde-core-devel, the attached patch seems to solve the problem, but it should be further tested and messages should be completed (mails by ossi and thiago). As it is not my code, I open this bug report to entrust the solution to the owner of the code
Comment 1 Gaël de Chalendar (aka Kleag) 2007-12-02 16:53:42 UTC
Created attachment 22281 [details]
patch changing kWarnings into qWarnings

As asked by reviewers, removed a stray space and endls
Comment 2 Gaël de Chalendar (aka Kleag) 2007-12-02 16:55:17 UTC
I forgot the gdb output. Here it is:
#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
Comment 3 Oswald Buddenhagen 2007-12-02 18:51:26 UTC
warningProlog does the required prefixing so one knows what goes wrong, so the patch should be fine.
Comment 4 Gaël de Chalendar (aka Kleag) 2007-12-03 09:54:49 UTC
patch commited as release 744368