Bug 110947

Summary: DOM Tree Viewer Unable to Catch Exceptions due to RTLD_LOCAL
Product: [Applications] konqueror Reporter: Dennis <shr3kst3r>
Component: khtmlAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: christophe, dawan, dima, faure, grundleborg, j.mairboeck, jmayer, mail, maksim, sami.liedes, wbsoft, zakrzewski.jakub
Priority: NOR    
Version: 3.5   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.6
Sentry Crash Report:

Description Dennis 2005-08-17 05:07:10 UTC
Version:           3.4.90 (using KDE KDE 3.4.90)
Installed from:    Compiled From Sources
Compiler:          gcc version 3.3.5-20050130 (Gentoo Linux 3.3.5.20050130-r1, ssp-3.3.5.20050130-1, pie-8.7.7.1)  
OS:                Linux

Way to reproduce:
1. Open konqueror
2. click "Show DOM Tree" (can be found under Tools)
3. Go back to original Konqueror window
4. Hit CTRL+t (or, "New Tab" works to)
5. Crash

Reproducable:
Every time

Backtrace:
Using host libthread_db library "/lib/tls/libthread_db.so.1".
`system-supplied DSO at 0xffffe000' has disappeared; keeping its symbols.
[Thread debugging using libthread_db enabled]
[New Thread -1231509280 (LWP 21288)]
[KCrash handler]
#4  0xffffe410 in __kernel_vsyscall ()
#5  0xb69b9b39 in raise () from /lib/tls/libc.so.6
#6  0xb69bb1b1 in abort () from /lib/tls/libc.so.6
#7  0xb6b61d97 in __cxa_call_unexpected ()
   from //usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libstdc++.so.5
#8  0xb6b61dd4 in std::terminate ()
   from //usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libstdc++.so.5
#9  0xb6b61f46 in __cxa_throw ()
   from //usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.5-20050130/libstdc++.so.5
#10 0xb6391f73 in DOM::DOMImplementation::createCSSStyleSheet ()
   from /home/shrek/kde3.5-alpha1/lib/libkhtml.so.4
#11 0xb5e60192 in DOMTreeView::connectToPart ()
   from /home/shrek/kde3.5-alpha1/lib/kde3/libdomtreeviewerplugin.so
#12 0xb5e60fd2 in DOMTreeView::slotSetHtmlPartDelayed ()
   from /home/shrek/kde3.5-alpha1/lib/kde3/libdomtreeviewerplugin.so
#13 0xb5e63804 in DOMTreeView::qt_invoke ()
   from /home/shrek/kde3.5-alpha1/lib/kde3/libdomtreeviewerplugin.so
#14 0xb712f7cc in QObject::activate_signal ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#15 0xb746e64a in QSignal::signal ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#16 0xb71499bd in QSignal::activate ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#17 0xb71512e3 in QSingleShotTimer::event ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#18 0xb70d2f1f in QApplication::internalNotify ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#19 0xb70d251e in QApplication::notify ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#20 0xb7736785 in KApplication::notify ()
   from /home/shrek/kde3.5-alpha1/lib/libkdecore.so.4
#21 0xb70c2765 in QEventLoop::activateTimers ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#22 0xb707b9bb in QEventLoop::processEvents ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#23 0xb70e5338 in QEventLoop::enterLoop ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#24 0xb70e51e8 in QEventLoop::exec ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#25 0xb70d3171 in QApplication::exec ()
   from /home/shrek/kde3.5-alpha1/lib/libqt-mt.so.3
#26 0xb682b0dc in kdemain ()
   from /home/shrek/kde3.5-alpha1/lib/libkdeinit_konqueror.so
#27 0xb7651816 in kdeinitmain ()
   from /home/shrek/kde3.5-alpha1/lib/kde3/konqueror.so
#28 0x0804cec3 in launch ()
#29 0x0804e6d1 in handle_launcher_request ()
#30 0x0804ec1d in handle_requests ()
#31 0x0804fd72 in main ()
Comment 1 Thiago Macieira 2005-08-22 01:57:17 UTC
Confirmed (3.5 r449049). Backtrace with debugging symbols:

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1233226048 (LWP 6107)]
[KCrash handler]
#7  0xffffe410 in ?? ()
#8  0xbfffe14c in ?? ()
#9  0x00000006 in ?? ()
#10 0x000017db in ?? ()
#11 0xb6d767e5 in raise () from /lib/tls/libc.so.6
#12 0xb6d78399 in abort () from /lib/tls/libc.so.6
#13 0xb6f338d7 in __gnu_cxx::__verbose_terminate_handler ()
   from /usr/lib/libstdc++.so.6
#14 0xb6f311c5 in __cxa_call_unexpected () from /usr/lib/libstdc++.so.6
#15 0xb6f31202 in std::terminate () from /usr/lib/libstdc++.so.6
#16 0xb6f31382 in __cxa_throw () from /usr/lib/libstdc++.so.6
#17 0xb604b57b in DOM::DOMImplementation::createCSSStyleSheet (this=0x0, 
    title=@0x0, media=@0x0) at dom_exception.h:60
#18 0xb5b63668 in DOMTreeView::connectToPart ()
   from /usr/local/kde3-r449049/lib/kde3/libdomtreeviewerplugin.so
#19 0xb5b641e2 in DOMTreeView::slotSetHtmlPartDelayed ()
   from /usr/local/kde3-r449049/lib/kde3/libdomtreeviewerplugin.so
#20 0xb5b6557a in DOMTreeView::qt_invoke ()
   from /usr/local/kde3-r449049/lib/kde3/libdomtreeviewerplugin.so
#21 0xb73a6e47 in QObject::activate_signal (this=0x83efb08, clist=0x871ae20, 
    o=0xbfffe5c0) at kernel/qobject.cpp:2355
#22 0xb7784bf4 in QSignal::signal (this=0x83efb08, t0=@0x83efb30)
    at .moc/debug-shared-mt/moc_qsignal.cpp:100
#23 0xb73c999e in QSignal::activate (this=0x83efb08) at kernel/qsignal.cpp:212
#24 0xb73d3aa3 in QSingleShotTimer::event (this=0x83efae0)
    at kernel/qtimer.cpp:286
#25 0xb7335f69 in QApplication::internalNotify (this=0xbfffefb0, 
    receiver=0x83efae0, e=0xbfffe8f0) at kernel/qapplication.cpp:2635
#26 0xb7335387 in QApplication::notify (this=0xbfffefb0, receiver=0x83efae0, 
    e=0xbfffe8f0) at kernel/qapplication.cpp:2358
#27 0xb7a88cb6 in KApplication::notify (this=0xbfffefb0, receiver=0x83efae0, 
    event=0xbfffe8f0)
    at /home/thiago/programs/src/kde3/KDE/kdelibs/kdecore/kapplication.cpp:550
#28 0xb72ba6c3 in QApplication::sendEvent (receiver=0x83efae0, 
    event=0xbfffe8f0) at qapplication.h:491
#29 0xb7320e76 in QEventLoop::activateTimers (this=0x80f0ed0)
    at kernel/qeventloop_unix.cpp:556
#30 0xb72d05d1 in QEventLoop::processEvents (this=0x80f0ed0, flags=4)
    at kernel/qeventloop_x11.cpp:389
#31 0xb734deea in QEventLoop::enterLoop (this=0x80f0ed0)
    at kernel/qeventloop.cpp:198
#32 0xb734de08 in QEventLoop::exec (this=0x80f0ed0)
    at kernel/qeventloop.cpp:145
#33 0xb733610d in QApplication::exec (this=0xbfffefb0)
    at kernel/qapplication.cpp:2758
#34 0xb648403f in kdemain (argc=0, argv=0x0)
    at /home/thiago/programs/src/kde3/KDE/kdebase/konqueror/konq_main.cc:206
#35 0xb6535554 in kdeinitmain (argc=0, argv=0x0)
    at ./konqueror/kdeinit_konqueror.la.cpp:3
#36 0x0804de4d in launch (argc=2, _name=0x807778c "konqueror", 
    args=0x80777a0 "\001", cwd=0x0, envc=1, envs=0x80777b1 "", 
    reset_env=false, tty=0x0, avoid_loops=false, startup_id_str=0x0)
    at /home/thiago/programs/src/kde3/KDE/kdelibs/kinit/kinit.cpp:637
#37 0x0804e63d in handle_launcher_request (sock=8)
    at /home/thiago/programs/src/kde3/KDE/kdelibs/kinit/kinit.cpp:1201
#38 0x0804ebf7 in handle_requests (waitForPid=0)
    at /home/thiago/programs/src/kde3/KDE/kdelibs/kinit/kinit.cpp:1404
#39 0x0804f476 in main (argc=2, argv=0xbffff934, envp=0x0)
    at /home/thiago/programs/src/kde3/KDE/kdelibs/kinit/kinit.cpp:1848
Comment 2 Pascal Létourneau 2005-11-10 04:42:02 UTC
*** Bug 116007 has been marked as a duplicate of this bug. ***
Comment 3 Maksim Orlovich 2006-07-04 19:54:41 UTC
*** Bug 127406 has been marked as a duplicate of this bug. ***
Comment 4 Maksim Orlovich 2006-11-15 15:55:23 UTC
*** Bug 127403 has been marked as a duplicate of this bug. ***
Comment 5 Maksim Orlovich 2006-11-15 15:57:51 UTC
*** Bug 137354 has been marked as a duplicate of this bug. ***
Comment 6 Jörg Mayer 2006-11-16 11:39:03 UTC
The problem still exists with current (3.5.5) Konquerror.
Comment 7 Tommi Tervo 2007-02-19 09:15:46 UTC
*** Bug 141902 has been marked as a duplicate of this bug. ***
Comment 8 Bram Schoenmakers 2007-03-17 12:18:40 UTC
*** Bug 143081 has been marked as a duplicate of this bug. ***
Comment 9 Tommi Tervo 2007-11-13 21:32:46 UTC
*** Bug 152264 has been marked as a duplicate of this bug. ***
Comment 10 Christophe Marin 2008-04-17 01:43:06 UTC
Confirmed in kde4 trunk (domtreeviewer rev. 780649) // kdelibs rev. 797569

Application: Konqueror (konqueror), signal SIGABRT
[Thread debugging using libthread_db enabled]
[New Thread 0xb61fe720 (LWP 11603)]
[KCrash handler]
#6  0xb7f4b410 in __kernel_vsyscall ()
#7  0xb6558085 in raise () from /lib/tls/i686/cmov/libc.so.6
#8  0xb6559a01 in abort () from /lib/tls/i686/cmov/libc.so.6
#9  0xb6767480 in __gnu_cxx::__verbose_terminate_handler ()
   from /usr/lib/libstdc++.so.6
#10 0xb6764d05 in ?? () from /usr/lib/libstdc++.so.6
#11 0xb6764d42 in std::terminate () from /usr/lib/libstdc++.so.6
#12 0xb6764e6a in __cxa_throw () from /usr/lib/libstdc++.so.6
#13 0xb4600d97 in DOM::DOMImplementation::createCSSStyleSheet (
    this=0xbf808ff4, title=@0xbf808fb8, media=@0xbf808fb0)
    at /media/sda7/kde/src/KDE/kdelibs/khtml/dom/dom_doc.cpp:131
#14 0xb275e837 in DOMTreeView::connectToPart (this=0x8a401f8)
    at /media/sda7/kde/src/extragear/base/konq-plugins/domtreeviewer/domtreeview.cpp:863
#15 0xb275ee82 in DOMTreeView::slotSetHtmlPartDelayed (this=0x8a401f8)
    at /media/sda7/kde/src/extragear/base/konq-plugins/domtreeviewer/domtreeview.cpp:901
#16 0xb275f561 in DOMTreeView::qt_metacall (this=0x8a401f8, 
    _c=QMetaObject::InvokeMetaMethod, _id=26, _a=0xbf8090dc)
    at /media/sda7/kde/build4/extragear/base/konq-plugins/domtreeviewer/domtreeview.moc:162
#17 0xb72704c7 in QMetaObject::activate (sender=0x8916f80, 
    from_signal_index=4, to_signal_index=4, argv=0x0)
    at kernel/qobject.cpp:3007
#18 0xb7270949 in QMetaObject::activate (sender=0x8916f80, m=0xb730aa68, 
    local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3080
#19 0xb727a4d5 in QSingleShotTimer::timeout (this=0x8916f80)
    at .moc/debug-shared/qtimer.moc:74
#20 0xb727a5f2 in QSingleShotTimer::timerEvent (this=0x8916f80)
    at kernel/qtimer.cpp:300
#21 0xb726e75e in QObject::event (this=0x8916f80, e=0xbf809614)
    at kernel/qobject.cpp:1105
#22 0xb69508fd in QApplicationPrivate::notify_helper (this=0x805d9d8, 
    receiver=0x8916f80, e=0xbf809614) at kernel/qapplication.cpp:3766
#23 0xb6950be3 in QApplication::notify (this=0xbf809a6c, receiver=0x8916f80, 
    e=0xbf809614) at kernel/qapplication.cpp:3360
#24 0xb78cc133 in KApplication::notify (this=0xbf809a6c, receiver=0x8916f80, 
    event=0xbf809614)
    at /media/sda7/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:311
#25 0xb725b63a in QCoreApplication::notifyInternal (this=0xbf809a6c, 
    receiver=0x8916f80, event=0xbf809614) at kernel/qcoreapplication.cpp:583
#26 0xb725f179 in QCoreApplication::sendEvent (receiver=0x8916f80, 
    event=0xbf809614)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#27 0xb728e065 in QTimerInfoList::activateTimers (this=0x8060cd4)
    at kernel/qeventdispatcher_unix.cpp:563
#28 0xb728b84c in timerSourceDispatch (source=0x8060ca0)
    at kernel/qeventdispatcher_glib.cpp:166
#29 0xb63d8bf8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#30 0xb63dbe5e in ?? () from /usr/lib/libglib-2.0.so.0
#31 0x08060098 in ?? ()
#32 0x00000000 in ?? ()
#0  0xb7f4b410 in __kernel_vsyscall ()
Comment 11 David Faure 2010-11-22 01:56:31 UTC
Reproduced indeed, and I don't get it; I see throw DOMException in Node::firstChild(), and that's called directly in a try/catch block (in DOMTreeView::slotShowTree), so this should not fail. The bug report topic says "due to RTLD_LOCAL", did someone identify this as the reason? konqueror dlopens khtmlpart.so and domtreeviewerplugin.so independently, so the latter can't catch the exceptions from the former? Ouch.
This would mean the only solution is to start opening parts and plugins with RTLD_GLOBAL, i.e. with QLibrary::ExportExternalSymbolsHint. Indeed... this patch works. http://www.davidfaure.fr/2010/kpluginloader.cpp.diff
The question is what does it break...
Comment 12 David Faure 2010-11-22 14:20:18 UTC
SVN commit 1199708 by dfaure:

Don't call load() in the constructor, but rather on-demand in all other methods, so that the
user of KPluginLoader has time to call setLoadHints(QLibrary::ExportExternalSymbolsHint) if needed.
CCBUG: 110947


 M  +10 -10    kpluginloader.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1199708
Comment 13 David Faure 2010-11-22 14:32:53 UTC
SVN commit 1199713 by dfaure:

Load parts using RTLD_GLOBAL so that the domtreeviewer can catch exceptions from khtmlpart.
Otherwise it just crashes. Since 2005...
BUG: 110947
FIXED-IN: 4.6


 M  +1 -0      konqfactory.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1199713
Comment 14 David Faure 2010-11-22 14:50:25 UTC
*** Bug 249640 has been marked as a duplicate of this bug. ***
Comment 15 David Faure 2010-11-22 14:51:16 UTC
*** Bug 247995 has been marked as a duplicate of this bug. ***