Bug 211360 - Kstscript can result in crash due to inappropriate locking
Summary: Kstscript can result in crash due to inappropriate locking
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.8.0
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-21 19:23 UTC by Andrew Walker
Modified: 2009-10-21 19:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2009-10-21 19:23:01 UTC
Version:           1.8.0 (using KDE 4.3.0)
OS:                Linux
Installed from:    Compiled From Sources

The following line run in js can cause a crash, but is highly dependent upon timing issues:

y=Kst.vectors[Kst.pluginManager.modules["Syncbin"].outputs[1].name];

The callstack is given below:

#0  0x00007f57049fe095 in raise () from /lib/libc.so.6
#1  0x00007f57049ffaf0 in abort () from /lib/libc.so.6
#2  0x00007f570b983fe7 in kstDebugBackend (nLevel=3, 
    nArea=<value optimized out>, 
    data=0x7f56f0112260 "FATAL: Thread 214206192 tried to write lock KstRWLock 0x621c38 while holding a read lock\n") at ksdebug.cpp:317
#3  0x00007f570b9840a2 in kstdbgstream::flush (this=0x7fff14c78820)
    at ksdebug.cpp:340
#4  0x000000000041a8c8 in kstdbgstream::operator<< (this=0x7fff14c78820, 
    string=<value optimized out>) at ../../../kst/src/libkst/ksdebug.h:240
#5  0x000000000041a8ee in endl (s=@0x3b3d)
    at ../../../kst/src/libkst/ksdebug.h:438
#6  0x00007f570b99bd3e in KstRWLock::writeLock (this=0x621c38) at rwlock.cpp:93
#7  0x00007f570bc5b23d in ~KstDataObject (this=0x7f56f0100790)
    at kstdataobject.cpp:70
#8  0x00007f57012cecac in ~Syncbin (this=0x3b3d) at syncbin.cpp:53
#9  0x00007f56fb8456ab in ~KstBindObject (this=0x7f56f00ea7b0)
    at bind_object.cpp:46
#10 0x00007f56fa09f560 in ?? () from /usr/lib/libkjs.so.1
#11 0x00007f56fa09f75e in ?? () from /usr/lib/libkjs.so.1
#12 0x00007f56fb84bd8b in KstBindVector::addBindings (
    this=<value optimized out>, exec=0x7fff14c797c0, obj=@0x7fff14c78a40)
    at bind_vector.cpp:275
#13 0x00007f56fb84c7c8 in KstBindVector (this=0x7f56f01bf160, 
    exec=0x7fff14c797c0, v=<value optimized out>, name=0x7f56fb8be2f7 "Vector")
    at bind_vector.cpp:30
#14 0x00007f56fb872755 in KstBindVectorCollection::extract (
    this=<value optimized out>, exec=0x7fff14c797c0, 
    item=<value optimized out>) at bind_vectorcollection.cpp:72
#15 0x00007f56fb86dc8e in KstBindCollection::get (this=0x7f56f01b2180, 
    exec=0x7fff14c797c0, propertyName=@0x7fff14c78c68)
    at bind_collection.cpp:135
#16 0x00007f56fa0be1cf in KJS::Reference::getValue () from /usr/lib/libkjs.so.1
#17 0x00007f56fa0be680 in ?? () from /usr/lib/libkjs.so.1
#18 0x00007f56fa0bfbb1 in ?? () from /usr/lib/libkjs.so.1
#19 0x00007f56fa0cb6b5 in ?? () from /usr/lib/libkjs.so.1
#20 0x00007f56fa0c87b9 in ?? () from /usr/lib/libkjs.so.1
#21 0x00007f56fa0bc7de in ?? () from /usr/lib/libkjs.so.1
#22 0x00007f56fa0ca5e2 in ?? () from /usr/lib/libkjs.so.1
#23 0x00007f56fa0c87b9 in ?? () from /usr/lib/libkjs.so.1
#24 0x00007f56fa0bc7de in ?? () from /usr/lib/libkjs.so.1
#25 0x00007f56fa0c9f8f in ?? () from /usr/lib/libkjs.so.1
#26 0x00007f56fa0c87b9 in ?? () from /usr/lib/libkjs.so.1
#27 0x00007f56fa0bc7de in ?? () from /usr/lib/libkjs.so.1
#28 0x00007f56fa0bc66b in KJS::DeclaredFunctionImp::execute ()
   from /usr/lib/libkjs.so.1
#29 0x00007f56fa0beadb in KJS::FunctionImp::call () from /usr/lib/libkjs.so.1
#30 0x00007f56fa0c2236 in KJS::Object::call () from /usr/lib/libkjs.so.1
#31 0x00007f56fa0ccc66 in ?? () from /usr/lib/libkjs.so.1
#32 0x00007f56fa0cb6b5 in ?? () from /usr/lib/libkjs.so.1
#33 0x00007f56fa0c8703 in ?? () from /usr/lib/libkjs.so.1
#34 0x00007f56fa0bc7de in ?? () from /usr/lib/libkjs.so.1
#35 0x00007f56fa0d4d00 in ?? () from /usr/lib/libkjs.so.1
#36 0x00007f56fa0d4f8d in KJS::Interpreter::evaluate ()
   from /usr/lib/libkjs.so.1
#37 0x00007f56fb085919 in KJSEmbed::KJSEmbedPart::execute ()
   from /usr/lib/libkjsembed.so.1
#38 0x00007f56fb837ddf in JSIfaceImpl::evaluate (this=0x987650, 
    script=@0x7fff14c7a180) at jsiface_impl.cpp:61
#39 0x00007f56fb8bc8d8 in JSIface::process (this=0x987650, 
    fun=<value optimized out>, data=<value optimized out>, 
    replyType=@0x7fff14c7a4d0, replyData=@0x7fff14c7a4c0)
    at jsiface_skel.cpp:33
#40 0x00007f5709902519 in DCOPClient::receive () from /usr/lib/libDCOP.so.4
#41 0x00007f57099037c8 in ?? () from /usr/lib/libDCOP.so.4
#42 0x00007f57099040c1 in ?? () from /usr/lib/libDCOP.so.4
#43 0x00007f570991218e in KDE_IceProcessMessages () from /usr/lib/libDCOP.so.4
#44 0x00007f57098fb3c7 in DCOPClient::processSocketData ()
   from /usr/lib/libDCOP.so.4
#45 0x00007f5709903df1 in DCOPClient::qt_invoke () from /usr/lib/libDCOP.so.4
#46 0x00007f570862dfd0 in QObject::activate_signal ()
   from /usr/lib/libqt-mt.so.3
#47 0x00007f570862e9a5 in QObject::activate_signal ()
   from /usr/lib/libqt-mt.so.3
#48 0x00007f57089a702c in QSocketNotifier::activated ()
   from /usr/lib/libqt-mt.so.3
#49 0x00007f570864edb0 in QSocketNotifier::event () from /usr/lib/libqt-mt.so.3
#50 0x00007f57085c633a in QApplication::internalNotify ()
   from /usr/lib/libqt-mt.so.3
#51 0x00007f57085c8093 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#52 0x00007f5709cfc6bd in KApplication::notify () from /usr/lib/libkdecore.so.4
#53 0x00007f570c67d180 in QApplication::sendEvent (
    receiver=0xffffffffffffffff, event=0x6)
    at /usr/share/qt3/include/qapplication.h:523
#54 0x00007f57085b8a6b in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/libqt-mt.so.3
#55 0x00007f570856c0e8 in QEventLoop::processEvents ()
   from /usr/lib/libqt-mt.so.3
#56 0x00007f57085e05bf in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#57 0x00007f57085e02ab in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#58 0x00007f57085c7e00 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#59 0x000000000041410f in main (argc=3, argv=0x7fff14c7c3e8) at main.cpp:854
Comment 1 Andrew Walker 2009-10-21 19:52:26 UTC
SVN commit 1038716 by arwalker:

BUG:211360 release the read lock in KstBindVectorCollection::extract(...) as soon as possible, so it cannot cause a later potential deadlock.

 M  +10 -2     bind_vectorcollection.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1038716