fix CppunitTest_dbaccess_SingleSelectQueryComposer_test deadlock (2)

similar to
    commit c02c75ba1e
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Thu Mar 27 14:28:02 2025 +0200
    fix CppunitTest_dbaccess_SingleSelectQueryComposer_test deadlock

deadlocking threads are

 in privateSnippetExecutor
 in connectivity::hsqldb::ODriverDelegator::shutdownConnection
 in connectivity::hsqldb::ODriverDelegator::disposing
 in privateSnippetExecutor
 in dbaccess::OConnection::disposing
 in dbaccess::OSharedConnection::close
 in SingleSelectQueryComposerTest::tearDown

and

Thread 42 (Thread 0x7f7d6e672700 (LWP 3544697) "DocumentEventNo"):
 in comphelper::SolarMutex::acquire
 in dbaccess::ModelMethodGuard::ModelMethodGuard
 in dbaccess::DocumentGuard::DocumentGuard
 in dbaccess::ODatabaseDocument::getCurrentController
in non-virtual thunk to
dbaccess::ODatabaseDocument::getCurrentController
 in tdoc_ucp::OfficeDocumentsManager::isWithoutOrInTopLevelFrame
 in tdoc_ucp::OfficeDocumentsManager::isOfficeDocument
 in tdoc_ucp::OfficeDocumentsManager::documentEventOccured
 in dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow
 in dbaccess::DocumentEventNotifier_Impl::processEvent
 in comphelper::AsyncEventNotifierBase::execute()
 in comphelper::AsyncEventNotifierAutoJoin::run()
 in threadFunc(void*) (param=0x36a7450)

Change-Id: Ifb8e37a05ce62ca37132e8391980de821bb97ee8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183428
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2025-03-28 10:36:40 +01:00
parent eadd7bfecd
commit e7d0b0d6b9
2 changed files with 9 additions and 0 deletions
+1
View File
@@ -32,6 +32,7 @@ $(eval $(call gb_Library_use_libraries,hsqldb,\
salhelper \
tl \
utl \
vcl \
i18nlangtag \
))
@@ -52,6 +52,7 @@
#include <i18nlangtag/languagetag.hxx>
#include <comphelper/diagnose_ex.hxx>
#include <o3tl/string_view.hxx>
#include <vcl/svapp.hxx>
#include <memory>
@@ -534,7 +535,14 @@ namespace connectivity
if ( xRow.is() && xRes->next() )
bLastOne = xRow->getInt(1) == 1;
if ( bLastOne )
{
// during shutdown, we are running on the main thread, and if we call this,
// it might trigger dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow
// which is running on a different thread, and that will call other code that tries
// to take the solar mutex.
SolarMutexReleaser aReleaser;
xStmt->execute(u"SHUTDOWN"_ustr);
}
}
}
}