summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-02 17:07:57 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-11-18 15:11:48 +0100
commit20bc83ee9e63c0c099ad9962ecc483ec5af88991 (patch)
treee9deeb88a600733e23aee27a0fc3fca89d2e9334 /dbaccess
parent7f5a87c501ba1291a93bf330cc1a1de19ea1d89c (diff)
crashtesting: intermittent failure on tdf118824-1.odb
this thread has been in the wars before: commit 490f83d4807a4223bae61d34913e5bd2bf952f3a Date: Fri Mar 9 09:12:54 2012 +0100 fdo#47021: the naive join attempt leads to deadlock commit a2095b151409f0fb57aa8feaa4c6282f84040245 Date: Tue Jul 26 23:42:36 2016 +0200 comphelper,vcl: let DeInitVCL() join some AsyncEventNotifier threads current backtrace is... Thread 1 (Thread 0x7fb9d9af6700 (LWP 32393)): 0 0x00007fb9eff83705 in () at /lib/x86_64-linux-gnu/libstdc++.so.6 1 0x00007fb9eff8375e in () at /lib/x86_64-linux-gnu/libstdc++.so.6 2 0x00007fb9dcc308df in __gnu_debug::_Safe_iterator_base::_Safe_iterator_base(__gnu_debug::_Safe_sequence_base const*, bool) (__constant=false, __seq=<optimized out>, this=0x7fb9d9af4338) at /usr/include/c++/8/debug/safe_base.h:91 3 0x00007fb9dcc308df in __gnu_debug::_Safe_iterator<std::_Rb_tree_iterator<std::pair<rtl::OUString const, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> > >, std::__debug::map<rtl::OUString, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> > > > >::_Safe_iterator(std::_Rb_tree_iterator<std::pair<rtl::OUString const, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> > > const&, __gnu_debug::_Safe_sequence_base const*) (__seq=<optimized out>, __i=..., this=0x7fb9d9af4330) at /usr/include/c++/8/debug/safe_iterator.h:130 4 0x00007fb9dcc308df in std::__debug::map<rtl::OUString, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> > > >::end() (this=<optimized out>) at /usr/include/c++/8/debug/map.h:181 5 0x00007fb9dcc308df in dbaccess::DocumentEvents::hasByName(rtl::OUString const&) (this=0x559229945690, Name="OnLoad") at /home/buildslave/source/libo-core/dbaccess/source/core/dataaccess/documentevents.cxx:199 6 0x00007fb9dcc2a4de in dbaccess::DocumentEventExecutor::documentEventOccured(com::sun::star::document::DocumentEvent const&) (this=0x559229981050, Event=...) at /home/buildslave/source/libo-core/include/com/sun/star/uno/Reference.h:380 aScriptDescriptor = {m_pImpl = std::unique_ptr<struct comphelper::NamedValueCollection_Impl> = {get() = 0x5592297d7700}} bScriptAssigned = <optimized out> bDispatchScriptURL = <optimized out> bNonEmptyScript = <optimized out> sEventType = "\004\000晦晦⦾喒\000\000\000\000\000䄨\xdce2ç¾¹\000°⧘喒\000èŒâ§’å–’\000°⧘喒\000\001晦晦晦䅨\xdce2ç¾¹\000ä† \xdce2ç¾¹\000ä‰ \xdce2ç¾¹\000䊨\xdce2ç¾¹\000䌀\xdce2ç¾¹\000䌸\xdce2ç¾¹\000ä¸\xdce2ç¾¹\000䎸\xdce2ç¾¹\000ä¸\xdce2ç¾¹\000ä¸\xdce2ç¾¹\000ä‘°\xdce2ç¾¹\000ä’ \xdce2ç¾¹\000䓘\xdce2ç¾¹\000䔈\xdce2ç¾¹\000ä• \xdce2ç¾¹\000ä– \xdce2ç¾¹\000ä—\xdce2ç¾¹\000䘀\xdce2ç¾¹\000䘰\xdce2ç¾¹\000䙨\xdce2ç¾¹\000䚨\xdce2ç¾¹\000ä› \xdce2ç¾¹\000䜘\xdce2ç¾¹\000ä\xdce2ç¾¹\000\000\000\000\000\000\000\000\000°⧘喒\000\000晦晦晦\000\000\000\000°⧘喒\000\000晦晦晦\000\000\000\000°⧘喒\000\000晦晦晦åšâ¦”å–’\000á⦘喒\000닰⦨喒", '\000' <repeats 13 times>, "\001\000晦晦\000\000\000\000"... sScript = "\004\000晦晦⦾喒\000\000\000\000\000䄨\xdce2ç¾¹\000°⧘喒\000èŒâ§’å–’\000°⧘喒\000\001晦晦晦䅨\xdce2ç¾¹\000ä† \xdce2ç¾¹\000ä‰ \xdce2ç¾¹\000䊨\xdce2ç¾¹\000䌀\xdce2ç¾¹\000䌸\xdce2ç¾¹\000ä¸\xdce2ç¾¹\000䎸\xdce2ç¾¹\000ä¸\xdce2ç¾¹\000ä¸\xdce2ç¾¹\000ä‘°\xdce2ç¾¹\000ä’ \xdce2ç¾¹\000䓘\xdce2ç¾¹\000䔈\xdce2ç¾¹\000ä• \xdce2ç¾¹\000ä– \xdce2ç¾¹\000ä—\xdce2ç¾¹\000䘀\xdce2ç¾¹\000䘰\xdce2ç¾¹\000䙨\xdce2ç¾¹\000䚨\xdce2ç¾¹\000ä› \xdce2ç¾¹\000䜘\xdce2ç¾¹\000ä\xdce2ç¾¹\000\000\000\000\000\000\000\000\000°⧘喒\000\000晦晦晦\000\000\000\000°⧘喒\000\000晦晦晦\000\000\000\000°⧘喒\000\000晦晦晦åšâ¦”å–’\000á⦘喒\000닰⦨喒", '\000' <repeats 13 times>, "\001\000晦晦\000\000\000\000"... xEventsSupplier = uno::Reference to (class dbaccess::ODatabaseDocument *) 0x559229d80188 xDocument = uno::Reference to (class dbaccess::ODatabaseDocument *) 0x559229d80108 __func__ = "documentEventOccured" 7 0x00007fb9dcc2b3cb in comphelper::OInterfaceContainerHelper2::NotifySingleListener<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator()(com::sun::star::uno::Reference<com::sun::star::document::XDocumentEventListener> const&) const (listener=#8 0x00007fb9dcc2b3cb in comphelper::OInterfaceContainerHelper2::forEach<com::sun::star::document::XDocumentEventListener, comphelper::OInterfaceContainerHelper2::NotifySingleListener<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> >(comphelper::OInterfaceContainerHelper2::NotifySingleListener<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> const&) (func=..., this=0x559229a8b340) at /home/buildslave/source/libo-core/include/comphelper/interfacecontainer2.hxx:266 iter = {rCont = @0x559229a8b340, aData = {pAsVector = 0x559229b71540, pAsInterface = 0x559229b71540}, nRemain = 0, bIsList = true} __func__ = "impl_notifyEvent_nothrow" 9 0x00007fb9dcc2b3cb in comphelper::OInterfaceContainerHelper2::notifyEach<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>(void (com::sun::star::document::XDocumentEventListener::*)(com::sun::star::document::DocumentEvent const&), com::sun::star::document::DocumentEvent const&) (Event=..., NotificationMethod=<optimized out>, this=0x559229a8b340) at /home/buildslave/source/libo-core/include/comphelper/interfacecontainer2.hxx:279 __func__ = "impl_notifyEvent_nothrow" 10 0x00007fb9dcc2b3cb in dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow(com::sun::star::document::DocumentEvent const&) (this=this@entry=0x559229a8b2f0, _rEvent=...) at /home/buildslave/source/libo-core/dbaccess/source/core/dataaccess/documenteventnotifier.cxx:196 __func__ = "impl_notifyEvent_nothrow" 11 0x00007fb9dcc2b638 in dbaccess::DocumentEventNotifier_Impl::processEvent(comphelper::AnyEvent const&) (this=0x559229a8b2f0, _rEvent=...) at /home/buildslave/source/libo-core/include/comphelper/asyncnotification.hxx:215 rEventHolder = <optimized out> 12 0x00007fb9ef271835 in comphelper::AsyncEventNotifierBase::execute() (this=0x559229a8c460) at /home/buildslave/source/libo-core/comphelper/source/misc/asyncnotification.cxx:163 aEvent = {aEvent = rtl::Reference to 0x559229872990, xProcessor = rtl::Reference to 0x559229a8b2f0} __PRETTY_FUNCTION__ = "virtual void comphelper::AsyncEventNotifierBase::execute()" 13 0x00007fb9ef26ffb9 in comphelper::AsyncEventNotifierAutoJoin::run() (this=0x559229a8c460) at /home/buildslave/source/libo-core/comphelper/source/misc/asyncnotification.cxx:268 14 0x00007fb9ef27d4ab in osl::threadFunc(void*) (param=0x559229a8c470) at /home/buildslave/source/libo-core/include/osl/thread.hxx:185 pObj = 0x559229a8c470 15 0x00007fb9f04645b6 in osl_thread_start_Impl(void*) (pData=0x559229aaa9e0) at /home/buildslave/source/libo-core/sal/osl/unx/thread.cxx:258 terminate = false pImpl = 0x559229aaa9e0 __PRETTY_FUNCTION__ = "void* osl_thread_start_Impl(void*)" 16 0x00007fb9efd12fa3 in start_thread () at /lib/x86_64-linux-gnu/libpthread.so.0 17 0x00007fb9f01574cf in clone () at /lib/x86_64-linux-gnu/libc.so.6 Change-Id: I265c6d35d5690750454920e4155d99073d9e51ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103868 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/documenteventnotifier.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
index 16b46ad6ddf8..13295523ef5f 100644
--- a/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
+++ b/dbaccess/source/core/dataaccess/documenteventnotifier.cxx
@@ -25,6 +25,7 @@
#include <comphelper/interfacecontainer2.hxx>
#include <cppuhelper/weak.hxx>
#include <tools/diagnose_ex.h>
+#include <vcl/svapp.hxx>
namespace dbaccess
{
@@ -141,21 +142,24 @@ namespace dbaccess
{
m_pEventBroadcaster->removeEventsForProcessor( this );
m_pEventBroadcaster->terminate();
- //TODO: a protocol is missing how to join with the thread before
- // exit(3), to ensure the thread is no longer relying on any
- // infrastructure while that infrastructure is being shut down
- // in atexit handlers; simply calling join here leads to
- // deadlock, as this thread holds the solar mutex while the
- // other thread is typically blocked waiting for the solar mutex
- // For now, use newAutoJoinAsyncEventNotifier which is
- // better than nothing.
- m_pEventBroadcaster.reset();
}
+ auto xEventBroadcaster = std::exchange(m_pEventBroadcaster, {});
+
lang::EventObject aEvent( m_rDocument );
aGuard.clear();
// <-- SYNCHRONIZED
+ if (xEventBroadcaster)
+ {
+ comphelper::SolarMutex& rSolarMutex = Application::GetSolarMutex();
+ // unblock threads blocked on that so we can join
+ sal_uInt32 nLockCount = (rSolarMutex.IsCurrentThread()) ? rSolarMutex.release(true) : 0;
+ xEventBroadcaster->join();
+ if (nLockCount)
+ rSolarMutex.acquire(nLockCount);
+ xEventBroadcaster.reset();
+ }
m_aLegacyEventListeners.disposeAndClear( aEvent );
m_aDocumentEventListeners.disposeAndClear( aEvent );