dbaccess_macros_test: no orderly shutdown

Stephan Bergmann sbergman at redhat.com
Wed Feb 15 11:12:07 PST 2012


Hi all,

Just experienced a spurious crash of cppunittester when executing 
Cppunit_dbaccess_macros_test, see backtraces below:

* Thread 5 is the main thread, already in exit(3).

* Thread 1 is executing a FastLoader thread 
(dbaccess/source/filter/xml/xmlfilter.cxx), and that code indeed has no 
provision to ensure that a spawned thread is orderly terminated (it 
spawns threads off of DatasourceURLListener::propertyChange in a 
fire-and-forget manner).  It is not immediately apparent how the 
protocol to request orderly termination of any spawned threads would 
look like here, but that such a facility is missing is a bug.

* Threads 2 and 3 are consequences of thread 1 (where the latter spawned 
a Java process).

* Thread 4 is executing a comphelper::AsyncEventNotifier.  That class is 
mentioned only in a few places 
(dbaccess/source/core/dataaccess/documenteventnotifier.cxx, 
extensions/source/propctrl/browserlistbox.cxx, and 
forms/source/component/ListBox.{hxx,cxx}), so it looks reasonable to 
assume that this one got spawned from dbaccess's 
documenteventnotifier.cxx.  And indeed, while the code there has a 
provision for terminating the spawned thread, it fails to join with it. 
  So, here it might be enough to do

> diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
> index 8d6b90d..24a46a2 100644
> --- a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
> +++ b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
> @@ -165,6 +165,7 @@ namespace dbaccess
>          {
>              m_pEventBroadcaster->removeEventsForProcessor( this );
>              m_pEventBroadcaster->terminate();
> +            m_pEventBroadcaster->join();
>              m_pEventBroadcaster = NULL;
>          }
>

-- unless that unearths any deadlocks.

Stephan


The backtraces:

> Core was generated by `/data/lo/core/solver/unxlngx6/bin/cppunit/cppunittester /data/lo/core/workdir/u'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x00002b4f11245e9d in rtl_string_newFromStr_WithLength (ppThis=0x2b4f27e50510, pCharStr=0x2b4f27e50590 "106 O+", nLen=4) at /data/lo/core/sal/rtl/source/strtmpl.cxx:1181
> 1181	    rtl_str_ImplCopy( (*ppThis)->buffer, pCharStr, nLen );
> (gdb) thread apply all bt
>
> Thread 5 (Thread 0x2b4f11ceb3c0 (LWP 7876)):
> #0  0x00002b4f206e5ee8 in _fini () from /data/lo/core/solver/unxlngx6/lib/libjvmaccessgcc3.so.3
> #1  0x00000037e640f79d in _dl_fini () at dl-fini.c:249
> #2  0x00000037e6839931 in __run_exit_handlers (status=0, listp=0x37e6baf668, run_list_atexit=true) at exit.c:78
> #3  0x00000037e68399b5 in __GI_exit (status=<optimized out>) at exit.c:100
> #4  0x00000037e68216a4 in __libc_start_main (main=0x404cd0 <main(int, char**)>, argc=11, ubp_av=0x7fff34045898, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff34045888) at libc-start.c:258
> #5  0x0000000000404689 in _start ()
>
> Thread 4 (Thread 0x2b4f3096e700 (LWP 7970)):
> #0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
> #1  0x00000037e6c09fb2 in _L_lock_910 () from /lib64/libpthread-2.14.90.so
> #2  0x00000037e6c09e4b in __pthread_mutex_lock (mutex=0x244e7f0) at pthread_mutex_lock.c:86
> #3  0x00002b4f1120a5dc in osl_acquireMutex (Mutex=0x244e7f0) at /data/lo/core/sal/osl/unx/mutex.c:130
> #4  0x00002b4f1d02bdf8 in vcl::SolarMutexObject::acquire (this=0x2502bb0) at /data/lo/core/vcl/source/app/solarmutex.cxx:44
> #5  0x00002b4f1d4dc90c in SalYieldMutex::acquire (this=0x2502bb0) at /data/lo/core/vcl/generic/app/geninst.cxx:59
> #6  0x00002b4f213399be in framework::LockHelper::acquireReadAccess (this=0x2b4f24886de0) at /data/lo/core/framework/source/fwi/threadhelp/lockhelper.cxx:263
> #7  0x00002b4f254aaa11 in framework::ReadGuard::lock (this=0x2b4f3096d5e0) at /data/lo/core/framework/inc/threadhelp/readguard.hxx:122
> #8  0x00002b4f254aa9c3 in framework::ReadGuard::ReadGuard (this=0x2b4f3096d5e0, rLock=...) at /data/lo/core/framework/inc/threadhelp/readguard.hxx:88
> #9  0x00002b4f2554b91b in framework::JobExecutor::notifyEvent (this=0x2b4f24886db8, aEvent=...) at /data/lo/core/framework/source/jobs/jobexecutor.cxx:234
> #10 0x00002b4f18662802 in SfxGlobalEvents_Impl::implts_notifyJobExecution (this=0x2b4f24a50d28, aEvent=...) at /data/lo/core/sfx2/source/notify/eventsupplier.cxx:811
> #11 0x00002b4f186618f5 in SfxGlobalEvents_Impl::documentEventOccured (this=0x2b4f24a50d28, _Event=...) at /data/lo/core/sfx2/source/notify/eventsupplier.cxx:652
> #12 0x00002b4f13968fc2 in cppu::OInterfaceContainerHelper::NotifySingleListener<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator() (this=0x2b4f3096d930, listener=...) at /data/lo/core/solver/unxlngx6/inc/cppuhelper/interfacecontainer.h:272
> #13 0x00002b4f13968d71 in cppu::OInterfaceContainerHelper::forEach<com::sun::star::document::XDocumentEventListener, cppu::OInterfaceContainerHelper::NotifySingleListener<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> > (this=0x2c9bca8, func=...) at /data/lo/core/solver/unxlngx6/inc/cppuhelper/interfacecontainer.h:289
> #14 0x00002b4f139688da in cppu::OInterfaceContainerHelper::notifyEach<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> (this=0x2c9bca8, NotificationMethod=&virtual table offset 32, Event=...) at /data/lo/core/solver/unxlngx6/inc/cppuhelper/interfacecontainer.h:303
> #15 0x00002b4f13967236 in dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow (this=0x2c9bc60, _rEvent=...) at /data/lo/core/dbaccess/source/core/dataaccess/documenteventnotifier.cxx:210
> #16 0x00002b4f13967e05 in dbaccess::DocumentEventNotifier_Impl::processEvent (this=0x2c9bc60, _rEvent=...) at /data/lo/core/dbaccess/source/core/dataaccess/documenteventnotifier.cxx:240
> #17 0x00002b4f13277a4f in comphelper::AsyncEventNotifier::run (this=0x2b4f27c435d0) at /data/lo/core/comphelper/source/misc/asyncnotification.cxx:235
> #18 0x00002b4f13968214 in osl::threadFunc (param=0x2b4f27c435d0) at /data/lo/core/solver/unxlngx6/inc/osl/thread.hxx:190
> #19 0x00002b4f1121542b in osl_thread_start_Impl (pData=0x2cf2850) at /data/lo/core/sal/osl/unx/thread.c:303
> #20 0x00000037e6c07d90 in start_thread (arg=0x2b4f3096e700) at pthread_create.c:309
> #21 0x00000037e68ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
>
> Thread 3 (Thread 0x2b4f30697700 (LWP 7958)):
> #0  0x00000037e68e26ed in read () at ../sysdeps/unix/syscall-template.S:82
> #1  0x00002b4f1125cfff in FileHandle_Impl::readFileAt (this=0x2b4f2671ed88, nOffset=0, pBuffer=0x2b4f30695d10, nBytesRequested=4096, pBytesRead=0x2b4f30696d20) at /data/lo/core/sal/osl/unx/file.cxx:478
> #2  0x00002b4f1125e858 in osl_readFile (Handle=0x2b4f2671ed88, pBuffer=0x2b4f30695d10, uBytesRequested=4096, pBytesRead=0x2b4f30696d20) at /data/lo/core/sal/osl/unx/file.cxx:1342
> #3  0x00002b4f30265abf in jfw_plugin::AsynchReader::run (this=0x2b4f27e50b10) at /data/lo/core/jvmfwk/plugins/sunmajor/pluginlib/util.cxx:339
> #4  0x00002b4f3026b5e9 in osl::threadFunc (param=0x2b4f27e50b10) at /data/lo/core/solver/unxlngx6/inc/osl/thread.hxx:190
> #5  0x00002b4f1121542b in osl_thread_start_Impl (pData=0x2b4f2c00a470) at /data/lo/core/sal/osl/unx/thread.c:303
> #6  0x00000037e6c07d90 in start_thread (arg=0x2b4f30697700) at pthread_create.c:309
> #7  0x00000037e68ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
>
> Thread 2 (Thread 0x2b4f27651700 (LWP 7956)):
> #0  0x00000037e68bb92d in __libc_waitpid (pid=<optimized out>, stat_loc=<optimized out>, options=<optimized out>) at ../sysdeps/unix/sysv/linux/waitpid.c:41
> #1  0x00002b4f11265e05 in ChildStatusProc (pData=0x2b4f27e4c410) at /data/lo/core/sal/osl/unx/process.cxx:626
> #2  0x00002b4f1121542b in osl_thread_start_Impl (pData=0x2b4f2c00a310) at /data/lo/core/sal/osl/unx/thread.c:303
> #3  0x00000037e6c07d90 in start_thread (arg=0x2b4f27651700) at pthread_create.c:309
> #4  0x00000037e68ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115
>
> Thread 1 (Thread 0x2b4f27e53700 (LWP 7955)):
> #0  0x00002b4f11245e9d in rtl_string_newFromStr_WithLength (ppThis=0x2b4f27e50510, pCharStr=0x2b4f27e50590 "106 O+", nLen=4) at /data/lo/core/sal/rtl/source/strtmpl.cxx:1181
> #1  0x00002b4f3026ab7a in rtl::OString::OString (this=0x2b4f27e50510, value=0x2b4f27e50590 "106 O+", length=4) at /data/lo/core/solver/unxlngx6/inc/rtl/string.hxx:165
> #2  0x00002b4f30265940 in jfw_plugin::FileHandleReader::readLine (this=0x2b4f27e50590, pLine=0x2b4f27e50b90) at /data/lo/core/jvmfwk/plugins/sunmajor/pluginlib/util.cxx:292
> #3  0x00002b4f3026620f in jfw_plugin::getJavaProps (exePath="file:///usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/bin/java", props=std::__debug::vector of length 0, capacity 0, bProcessRun=0x2b4f27e5118f) at /data/lo/core/jvmfwk/plugins/sunmajor/pluginlib/util.cxx:460
> #4  0x00002b4f30268326 in jfw_plugin::getJREInfoByPath (path="file:///usr/lib/jvm/java-1.6.0-openjdk.x86_64") at /data/lo/core/jvmfwk/plugins/sunmajor/pluginlib/util.cxx:948
> #5  0x00002b4f30258e11 in jfw_plugin_getJavaInfoByPath (path=0x2b4f2786ba88, sVendor=0x2b4f27853b48, sMinVersion=0x2b4f27875ad0, sMaxVersion=0x2b4f11275234, arExcludeList=0x2b4f2c0025a0, nLenList=0, ppInfo=0x2b4f27e51fe8) at /data/lo/core/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx:377
> #6  0x00002b4f20487bb8 in jfw_getJavaInfoByPath (pPath=0x2b4f2786ba88, ppInfo=0x2b4f27e522a0) at /data/lo/core/jvmfwk/source/framework.cxx:803
> #7  0x00002b4f204874c6 in jfw_getSelectedJRE (ppInfo=0x2b4f27e524d0) at /data/lo/core/jvmfwk/source/framework.cxx:687
> #8  0x00002b4f20485ad4 in jfw_startVM (arOptions=0x2b4f2c0019b0, cOptions=0, ppVM=0x2b4f27878b38, ppEnv=0x2b4f27e527b8) at /data/lo/core/jvmfwk/source/framework.cxx:339
> #9  0x00002b4f3001df7f in stoc_javavm::JavaVirtualMachine::getJavaVM (this=0x2b4f27878a98, rProcessId=uno::Sequence of length 17 = {...}) at /data/lo/core/stoc/source/javavm/javavm.cxx:786
> #10 0x00002b4f1e795d73 in connectivity::getJavaVM (_rxFactory=...) at /data/lo/core/connectivity/source/commontools/CommonTools.cxx:248
> #11 0x00002b4f269dc930 in dbaxml::(anonymous namespace)::FastLoader::run (this=0x2b4f27c4ae98) at /data/lo/core/dbaccess/source/filter/xml/xmlfilter.cxx:120
> #12 0x00002b4f269e156f in osl::threadFunc (param=0x2b4f27c4ae98) at /data/lo/core/solver/unxlngx6/inc/osl/thread.hxx:190
> #13 0x00002b4f1121542b in osl_thread_start_Impl (pData=0x2ce7ae0) at /data/lo/core/sal/osl/unx/thread.c:303
> #14 0x00000037e6c07d90 in start_thread (arg=0x2b4f27e53700) at pthread_create.c:309
> #15 0x00000037e68ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115


More information about the LibreOffice mailing list