Thread-safety issue in KConfig / KStandardDirs ?
Sandro Andrade
sandro.andrade at gmail.com
Mon Jun 7 15:47:46 BST 2010
Hi there,
I'm facing again another possibly thread-safety issue in KConfig.
Since KConfig is not thread-safe and probably non-const methods are
being called from different
threads, should I lock threads properly or KConfig could somehow prevent this ?
Thanks,
Sandro
Thread 1 (Thread 0xb4314ae0 (LWP 9798)):
[KCrash Handler]
#7 operator< (this=0x9f3ca40, aupdate=0xbf822cf0, akey=...) at
/data/kdesvn/kdelibs/kdecore/config/kconfigdata.h:122
#8 qMapLessThanKey<KEntryKey> (this=0x9f3ca40, aupdate=0xbf822cf0,
akey=...) at /data/kdesvn/install/qt4/include/QtCore/qmap.h:107
#9 QMap<KEntryKey, KEntry>::mutableFindNode (this=0x9f3ca40,
aupdate=0xbf822cf0, akey=...) at
/data/kdesvn/install/qt4/include/QtCore/qmap.h:760
#10 0xb76c91e4 in QMap<KEntryKey, KEntry>::insert (this=0x9f3ca40,
group=..., key=..., value=..., options=...) at
/data/kdesvn/install/qt4/include/QtCore/qmap.h:540
#11 KEntryMap::setEntry (this=0x9f3ca40, group=..., key=...,
value=..., options=...) at
/data/kdesvn/kdelibs/kdecore/config/kconfigdata.h:284
#12 0xb76dd320 in KConfigIniBackend::parseConfig (this=0xa3f149f8,
currentLocale=..., entryMap=..., options=..., merging=false) at
/data/kdesvn/kdelibs/kdecore/config/kconfigini.cpp:252
#13 0xb76de236 in KConfigIniBackend::parseConfig (this=0xa3f149f8,
currentLocale=..., entryMap=..., options=...) at
/data/kdesvn/kdelibs/kdecore/config/kconfigini.cpp:66
#14 0xb76c45c4 in KConfigPrivate::parseGlobalFiles (this=0x9f3ca28) at
/data/kdesvn/kdelibs/kdecore/config/kconfig.cpp:484
#15 0xb76c4d04 in KConfig::reparseConfiguration (this=0xa0460f8) at
/data/kdesvn/kdelibs/kdecore/config/kconfig.cpp:451
#16 0xb75aa3ce in KDevelop::Project::projectConfiguration
(this=0xa041490) at /data/kdesvn/kdevplatform/shell/project.cpp:468
#17 0xb0a7e746 in CMake::currentBuildDir (project=0xa041490) at
/data/kdesvn/kdevelop/projectmanagers/cmake/cmakeutils.cpp:123
#18 0xb0a050bf in CMakeManager::buildDirectory (this=0xa071868,
item=0xa079108) at
/data/kdesvn/kdevelop/projectmanagers/cmake/cmakemanager.cpp:175
#19 0xa8ecd01b in IncludePathComputer::computeForeground
(this=0xa3d96738) at
/data/kdesvn/kdevelop/languages/cpp/includepathcomputer.cpp:85
#20 0xa8ec5cef in CppLanguageSupport::findIncludePathsForJob
(this=0xa857968, job=0xb2c61b0) at
/data/kdesvn/kdevelop/languages/cpp/cpplanguagesupport.cpp:396
#21 0xa8ec91f9 in CppLanguageSupport::qt_metacall (this=0xa857968,
_c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>,
_a=0xa790b30)
at /data/kdesvn/build/kdevelop/languages/cpp/cpplanguagesupport.moc:142
#22 0xb61fc586 in QMetaObject::metacall (object=0xa857968,
cl=QMetaObject::InvokeMetaMethod, idx=11, argv=0xa790b30) at
/data/kdesvn/qt-copy/src/corelib/kernel/qmetaobject.cpp:237
#23 0xb6209729 in QMetaCallEvent::placeMetaCall (this=0xb794350,
object=0xa857968) at
/data/kdesvn/qt-copy/src/corelib/kernel/qobject.cpp:561
#24 0xb620a8c3 in QObject::event (this=0xa857968, e=0xb794350) at
/data/kdesvn/qt-copy/src/corelib/kernel/qobject.cpp:1248
#25 0xb5597398 in QApplicationPrivate::notify_helper (this=0x9e11da8,
receiver=0xa857968, e=0xb794350) at
/data/kdesvn/qt-copy/src/gui/kernel/qapplication.cpp:4304
#26 0xb5594c43 in QApplication::notify (this=0xbf823da8,
receiver=0xa857968, e=0xb794350) at
/data/kdesvn/qt-copy/src/gui/kernel/qapplication.cpp:3708
#27 0xb65b69aa in KApplication::notify (this=0xbf823da8,
receiver=0xa857968, event=0xb794350) at
/data/kdesvn/kdelibs/kdeui/kernel/kapplication.cpp:302
#28 0xb61f5683 in QCoreApplication::notifyInternal (this=0xbf823da8,
receiver=0xa857968, event=0xb794350) at
/data/kdesvn/qt-copy/src/corelib/kernel/qcoreapplication.cpp:704
#29 0xb6c86669 in QCoreApplication::sendEvent (receiver=0xa857968,
event=0xb794350) at
../../../../include/QtCore/../../../../qt-copy/src/corelib/kernel/qcoreapplication.h:215
#30 0xb61f6719 in QCoreApplicationPrivate::sendPostedEvents
(receiver=0x0, event_type=0, data=0x9dccf48) at
/data/kdesvn/qt-copy/src/corelib/kernel/qcoreapplication.cpp:1345
#31 0xb61f63d1 in QCoreApplication::sendPostedEvents (receiver=0x0,
event_type=0) at
/data/kdesvn/qt-copy/src/corelib/kernel/qcoreapplication.cpp:1238
#32 0xb622820a in QCoreApplication::sendPostedEvents () at
../../include/QtCore/../../../../qt-copy/src/corelib/kernel/qcoreapplication.h:220
#33 0xb62273a2 in postEventSourceDispatch (s=0x9e14ab0) at
/data/kdesvn/qt-copy/src/corelib/kernel/qeventdispatcher_glib.cpp:276
#34 0xb4613f72 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#35 0xb4614750 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#36 0xb4614a04 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#37 0xb6227b32 in QEventDispatcherGlib::processEvents (this=0x9dcc9f8,
flags=...) at /data/kdesvn/qt-copy/src/corelib/kernel/qeventdispatcher_glib.cpp:412
#38 0xb5659a64 in QGuiEventDispatcherGlib::processEvents
(this=0x9dcc9f8, flags=...) at
/data/kdesvn/qt-copy/src/gui/kernel/qguieventdispatcher_glib.cpp:204
#39 0xb61f33fd in QEventLoop::processEvents (this=0xbf823bfc,
flags=...) at /data/kdesvn/qt-copy/src/corelib/kernel/qeventloop.cpp:149
#40 0xb61f3541 in QEventLoop::exec (this=0xbf823bfc, flags=...) at
/data/kdesvn/qt-copy/src/corelib/kernel/qeventloop.cpp:201
#41 0xb61f5d58 in QCoreApplication::exec () at
/data/kdesvn/qt-copy/src/corelib/kernel/qcoreapplication.cpp:981
#42 0xb5594872 in QApplication::exec () at
/data/kdesvn/qt-copy/src/gui/kernel/qapplication.cpp:3583
#43 0x08050f37 in main (argc=<value optimized out>, argv=0xa3d67e70)
at /data/kdesvn/kdevelop/app/main.cpp:378
Sandro
On Sat, Apr 24, 2010 at 6:09 AM, Thiago Macieira <thiago at kde.org> wrote:
> Em Sábado 24. Abril 2010, às 10.53.27, Oswald Buddenhagen escreveu:
>> On Fri, Apr 23, 2010 at 09:36:45PM -0300, Sandro Andrade wrote:
>> > KConfig / KStandardDirs are thread-safe ?
>>
>> kstandarddirs' thread-safety is documented.
>> kconfig is most definitely not thread-safe, but it is re-entrant. you
>> may get lucky with the const methods just like in kstddirs.
>
> Besides, the crash was in malloc. Malloc is thread-safe.
>
> Unless, of course, you've already done memory smashing and destroyed malloc
> control data.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Senior Product Manager - Nokia, Qt Development Frameworks
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
More information about the kde-core-devel
mailing list