Bug 144256 - Missing destruction of FirebirdDriver::~FirebirdDriver, OSDBCDriverManager::~OSDBCDriverManager, OPoolCollection::~OPoolCollection opening and closing an ODB
Summary: Missing destruction of FirebirdDriver::~FirebirdDriver, OSDBCDriverManager::~...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.2.1.1 rc
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Database-Firebird-Default
  Show dependency treegraph
 
Reported: 2021-09-02 06:39 UTC by Mike Kaganski
Modified: 2023-10-20 08:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2021-09-02 06:39:07 UTC
1. Put breakpoints to ctors and dtors of
  - FirebirdDriver,
  - OSDBCDriverManager,
  - OPoolCollection

2. Open attachment 174687 [details] and navigate to Tables
  - see that the ctors get called

3. Close LibreOffice
  - see that dtors don't get called

=> one consequence is that temporary directories are kept on disk

Tested with 7.2.1.1 and current master on Windows.
Comment 1 Stephan Bergmann 2021-09-02 12:43:16 UTC
drivermanager::OSDBCDriverManager (connectivity/source/manager/mdrivermanager.hxx) is the single-instance implementation of the css.sdbc.DriverManager service (cf. connectivity/source/manager/sdbc2.component).  In the reproducer scenario it does get a css.lang.XComponent::dispose call from cppuhelper::ServiceManager::disposing (cppuhelper/source/servicemanager.cxx) as expected.  So there must be some other reason (an unbroken circular dependencies perhaps?) that prevents destruction despite the dispose() call.
Comment 2 Julien Nabet 2021-09-03 17:03:01 UTC
I don't know if it can help but since several years, I've got this when closing odb files:
warn:dbaccess:68925:68925:dbaccess/source/core/dataaccess/ModelImpl.cxx:926:  com.sun.star.container.NoSuchElementException message: /home/julien/lo/libreoffice/package/source/xstor/xstorage.cxx:2974:  /home/julien/lo/libreoffice/package/source/xstor/xstorage.cxx:2974
warn:dbaccess:68925:68925:dbaccess/source/core/dataaccess/ModelImpl.cxx:926:  com.sun.star.container.NoSuchElementException message: /home/julien/lo/libreoffice/package/source/xstor/xstorage.cxx:2974:  /home/julien/lo/libreoffice/package/source/xstor/xstorage.cxx:2974

Also, perhaps a relation with tdf#57979 (or even tdf#77141)?
I mean all these show a pb when closing odb files.
Comment 3 Julien Nabet 2021-12-20 11:28:17 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.

For the record, I gave a try too with HSQLDBembedded, I got:
at the opening
OPoolCollection ctr
OSDBCDriverManager ctr
ODriverDelegator ctr
ODriverDelegator loadDriver

at the closing (without having created anything, table, ...)
ODriverDelegator flushConnections
ODriverDelegator shutdownConnections

so no dtr for:
ODriverDelegator
OSDBCDriverManager
OPoolCollection

In comparison I got call to UnxSplashScreen ctr and dtr when closing LO.

Let's put 7.2.1.1 but I think this behaviour is older than this.
Comment 4 Julien Nabet 2022-01-26 20:51:20 UTC
Let's increase a bit importance since it seems to impact several types of databases and not only Firebird which is experimental.
Comment 5 Julien Nabet 2022-09-18 16:36:36 UTC
I gave a new try with hsqldb and put trace in every constructor and destructor + some other methods but don't see where can be the pb.

=> when launching odb file
ODatabaseSource ctr 0x55746c415400
ODatabaseSource disposing 0x55746c415400
ODatabaseSource dtr 0x55746c415400
warn:legacy.osl:47987:47987:dbaccess/source/core/dataaccess/ModelImpl.cxx:767: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from!
ODatabaseSource ctr 0x55746c39a780
warn:legacy.osl:47987:47987:dbaccess/source/core/dataaccess/ModelImpl.cxx:767: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from!
warn:legacy.osl:47987:47987:dbaccess/source/core/dataaccess/ModelImpl.cxx:767: ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage from!
ODatabaseSource disposing 0x55746c39a780
ODatabaseSource dtr 0x55746c39a780

=> when clicking on tables
OGenericUnoController ctr 0x55746c4d3d00
OApplicationController ctr 0x55746c4d3d00
ODatabaseSource ctr 0x55746c0bb510
ODatasourceConnector ctr 0x7ffc68d65b48
OSharedConnectionManager ctr 0x55746cb60a30
ODatabaseSource::buildIsolatedConnection 0x55746c0bb510
ODatabaseSource::buildLowLevelConnection 0x55746c0bb510
OPoolCollection ctr 0x55746cb713b0
OSDBCDriverManager ctr 0x55746cbec1c0
ODriverDelegator ctr 0x55746cbaba70
ODriverDelegator::loadDriver 0x55746cbaba70
FlushNotificationAdapter installAdapter
FlushNotificationAdapter ctr 0x55746cff5b90
OConnection ctr 0x55746cffbaa0
OGenericUnoController::startConnectionListening 0x55746c4d3d00
ODatasourceConnector dtr 0x7ffc68d65b48

=> when closing odb file
OApplicationController disposing void 0x55746c4d3d00
OApplicationController disconnect 0x55746c4d3d00
OGenericUnoController::stopConnectionListening 0x55746c4d3d00
FlushNotificationAdapter flushed 0x55746cff5b90
OSharedConnectionManager disposing 0x55746cb60a30
OConnection::disposing 0x55746cffbaa0
OConnection dtr 0x55746cffbaa0
FlushNotificationAdapter disposing 0x55746cff5b90
FlushNotificationAdapter impl_dispose 0x55746cff5b90
FlushNotificationAdapter dtr 0x55746cff5b90
ODatabaseSource disposing 0x55746c0bb510
OSharedConnectionManager dtr 0x55746cb60a30
ODatabaseSource ctr 0x55746cac2330
ODatabaseSource disposing 0x55746cac2330
ODatabaseSource dtr 0x55746cac2330
ODatabaseSource dtr 0x55746c0bb510
OApplicationController dtr 0x55746c4d3d00
OGenericUnoController dtr 0x55746c4d3d00

Here's part of a bt from OPoolCollection ctr:
#0  connectivity::OPoolCollection::OPoolCollection(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
    (this=0x555f1f400ef0, _rxContext=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x555f1ca28a70) at connectivity/source/cpool/ZPoolCollection.cxx:75
#1  0x00007f62f9d125f5 in connectivity_OPoolCollection_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (context=0x555f1ca28a70)
    at connectivity/source/cpool/ZPoolCollection.cxx:467
#2  0x00007f632fdebdba in std::__invoke_impl<com::sun::star::uno::XInterface*, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(std::__invoke_other, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
     (__f=@0x555f1ca51b38: 0x7f62f9d125a0 <connectivity_OPoolCollection_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>, __args=@0x7ffe7f3e7030: 0x555f1ca28a70, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:61
#3  0x00007f632fdebd37 in std::__invoke_r<com::sun::star::uno::XInterface*, com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&>(com::sun::star::uno::XInterface* (*&)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)
     (__fn=@0x555f1ca51b38: 0x7f62f9d125a0 <connectivity_OPoolCollection_get_implementation(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>, __args=@0x7ffe7f3e7030: 0x555f1ca28a70, __args=empty uno::Sequence) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:114
#4  0x00007f632fdebc07 in std::_Function_handler<com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XInterface* (*)(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::_M_invoke(std::_Any_data const&, com::sun::star::uno::XComponentContext*&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) (__functor=..., __args=@0x7ffe7f3e7030: 0x555f1ca28a70, __args=empty uno::Sequence)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:290
#5  0x00007f632fdb2743 in std::function<com::sun::star::uno::XInterface* (com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator()(com::sun::star::uno::XComponentContext*, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const (this=0x555f1ca51b38, __args=0x555f1ca28a70, __args=empty uno::Sequence)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:591
#6  0x00007f632fd9aba6 in cppuhelper::ServiceManager::Data::Implementation::doCreateInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
    (this=0x555f1ca51a80, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x555f1ca28a70) at cppuhelper/source/servicemanager.cxx:706
#7  0x00007f632fd9aa94 in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool)
    (this=0x555f1ca51a80, context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x555f1ca28a70, singletonRequest=false) at cppuhelper/source/servicemanager.cxx:675
#8  0x00007f632fda0aad in cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
    (this=0x555f1ca0b170, aServiceSpecifier="com.sun.star.sdbc.ConnectionPool", Context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x555f1ca28a70)
    at cppuhelper/source/servicemanager.cxx:1006
#9  0x00007f632fda1457 in non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) ()
    at /home/julien/lo/libreoffice/instdir/program/libuno_cppuhelpergcc3.so.3
#10 0x00007f62fb794951 in com::sun::star::sdbc::ConnectionPool::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
    (the_context=uno::Reference to (cppu::(anonymous namespace)::ComponentContext *) 0x555f1ca28a70) at workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/sdbc/ConnectionPool.hpp:38
#11 0x00007f62fb783810 in dbaccess::ODatabaseSource::buildLowLevelConnection(rtl::OUString const&, rtl::OUString const&) (this=0x555f1efcdb80, _rUid="", _rPwd="")
    at dbaccess/source/core/dataaccess/datasource.cxx:686
#12 0x00007f62fb77ff15 in dbaccess::ODatabaseSource::buildIsolatedConnection(rtl::OUString const&, rtl::OUString const&) (this=0x555f1efcdb80, user="", password="")
    at dbaccess/source/core/dataaccess/datasource.cxx:1236
#13 0x00007f62fb77f7f9 in dbaccess::OSharedConnectionManager::getConnection(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, dbaccess::ODatabaseSource*) (this=0x555f1f4be0e0, url="sdbc:embedded:hsqldb", user="", password="", _aInfo=uno::Sequence of length 54 = {...}, _pDataSource=0x555f1efcdb80)
    at dbaccess/source/core/dataaccess/datasource.cxx:394
#14 0x00007f62fb789535 in dbaccess::ODatabaseSource::getConnection(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555f1efcdb80, user="", password="", _bIsolated=false)
    at dbaccess/source/core/dataaccess/datasource.cxx:1267
#15 0x00007f62fb789166 in dbaccess::ODatabaseSource::getConnection(rtl::OUString const&, rtl::OUString const&) (this=0x555f1efcdb80, user="", password="") at dbaccess/source/core/dataaccess/datasource.cxx:1136
#16 0x00007f62fb789767 in non-virtual thunk to dbaccess::ODatabaseSource::getConnection(rtl::OUString const&, rtl::OUString const&) () at dbaccess/source/core/dataaccess/datasource.cxx:1280
#17 0x00007f62fa7b20b3 in dbaui::ODatasourceConnector::connect(com::sun::star::uno::Reference<com::sun::star::sdbc::XDataSource> const&, dbtools::SQLExceptionInfo*) const
    (this=0x7ffe7f3e87e8, _xDataSource=uno::Reference to (dbaccess::ODatabaseSource *) 0x555f1efcdbf0, _pErrorInfo=0x0) at dbaccess/source/ui/misc/datasourceconnector.cxx:141
#18 0x00007f62fa7b12da in dbaui::ODatasourceConnector::connect(rtl::OUString const&, dbtools::SQLExceptionInfo*) const
    (this=0x7ffe7f3e87e8, _rDataSourceName="file:///home/julien/Documents/testjul.odb", _pErrorInfo=0x0) at dbaccess/source/ui/misc/datasourceconnector.cxx:91
#19 0x00007f62fa5acef2 in dbaui::OGenericUnoController::connect(rtl::OUString const&, rtl::OUString const&, dbtools::SQLExceptionInfo*)
     (this=0x555f1ed19740, _rDataSourceName="file:///home/julien/Documents/testjul.odb", _rContextInformation="The connection to the data source \"testjul\" could not be established.", _pErrorInfo=0x0)
    at dbaccess/source/ui/browser/genericcontroller.cxx:902
#20 0x00007f62fa480caa in dbaui::OApplicationController::ensureConnection(dbtools::SQLExceptionInfo*) (this=0x555f1ed19740, _pErrorInfo=0x0) at dbaccess/source/ui/app/AppControllerDnD.cxx:324
#21 0x00007f62fa44061c in dbaui::OApplicationController::onContainerSelect(dbaui::ElementType) (this=0x555f1ed19740, _eType=dbaui::E_TABLE) at dbaccess/source/ui/app/AppController.cxx:1629
--Type <RET> for more, q to quit, c to continue without paging--
#22 0x00007f62fa4c9b89 in dbaui::OApplicationSwapWindow::onContainerSelected(dbaui::ElementType) (this=0x555f1ed26770, _eType=dbaui::E_TABLE) at dbaccess/source/ui/app/AppSwapWindow.cxx:99
#23 0x00007f62fa4c9d90 in dbaui::OApplicationSwapWindow::OnContainerSelectHdl(ThumbnailViewItem const*) (this=0x555f1ed26770, pEntry=0x555f1ecf7140) at dbaccess/source/ui/app/AppSwapWindow.cxx:117
#24 0x00007f62fa4c991d in dbaui::OApplicationSwapWindow::LinkStubOnContainerSelectHdl(void*, ThumbnailViewItem const*) (instance=0x555f1ed26770, data=0x555f1ecf7140)
    at dbaccess/source/ui/app/AppSwapWindow.cxx:112
Comment 6 Julien Nabet 2023-10-01 11:07:33 UTC
I gave a new try with Firebird embedded (to avoid all Java part).
I noticed 2 things:
1) the bt of the ctr of Firebird connection is completely different from the dtr  one.
First one is:
#0  connectivity::firebird::Connection::Connection() (this=0x55dadfe069f0) at connectivity/source/drivers/firebird/Connection.cxx:98
#1  0x00007f274432ac11 in connectivity::firebird::FirebirdDriver::connect(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
    (this=0x55dadf1583c0, url="sdbc:embedded:firebird", info=uno::Sequence of length 4 = {...}) at connectivity/source/drivers/firebird/Driver.cxx:163
#2  0x00007f274432ae64 in non-virtual thunk to connectivity::firebird::FirebirdDriver::connect(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
    at /home/julien/lo/libreoffice/instdir/program/../program/libfirebird_sdbclo.so
#3  0x00007f2744413ee8 in connectivity::OPoolCollection::getConnectionWithInfo(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
    (this=0x55dadfd7ba30, _rURL="sdbc:embedded:firebird", _rInfo=uno::Sequence of length 4 = {...}) at connectivity/source/cpool/ZPoolCollection.cxx:121
#4  0x00007f27444146f4 in non-virtual thunk to connectivity::OPoolCollection::getConnectionWithInfo(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) ()
    at /home/julien/lo/libreoffice/instdir/program/../program/libdbpool2.so
#5  0x00007f27465432ec in dbaccess::ODatabaseSource::buildLowLevelConnection(rtl::OUString const&, rtl::OUString const&) (this=0x55dadf679920, _rUid="", _rPwd="")
    at dbaccess/source/core/dataaccess/datasource.cxx:749
#6  0x00007f274653e9a9 in dbaccess::ODatabaseSource::buildIsolatedConnection(rtl::OUString const&, rtl::OUString const&) (this=0x55dadf679920, user="", password="")
    at dbaccess/source/core/dataaccess/datasource.cxx:1213
#7  0x00007f274653e2e8 in dbaccess::OSharedConnectionManager::getConnection(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, dbaccess::ODatabaseSource*) (this=0x55dadfe220c0, url="sdbc:embedded:firebird", user="", password="", _aInfo=uno::Sequence of length 54 = {...}, _pDataSource=0x55dadf679920)
    at dbaccess/source/core/dataaccess/datasource.cxx:376
#8  0x00007f27465480d7 in dbaccess::ODatabaseSource::getConnection(rtl::OUString const&, rtl::OUString const&, bool) (this=0x55dadf679920, user="", password="", _bIsolated=false)
    at dbaccess/source/core/dataaccess/datasource.cxx:1244
#9  0x00007f2746547d13 in dbaccess::ODatabaseSource::getConnection(rtl::OUString const&, rtl::OUString const&) (this=0x55dadf679920, user="", password="") at dbaccess/source/core/dataaccess/datasource.cxx:1114
#10 0x00007f2746548324 in non-virtual thunk to dbaccess::ODatabaseSource::getConnection(rtl::OUString const&, rtl::OUString const&) () at dbaccess/source/core/dataaccess/datasource.cxx:1257
#11 0x00007f2737d5dc70 in dbaui::ODatasourceConnector::connect(com::sun::star::uno::Reference<com::sun::star::sdbc::XDataSource> const&, dbtools::SQLExceptionInfo*) const
    (this=0x7ffd99aab1b8, _xDataSource=uno::Reference to (dbaccess::ODatabaseSource *) 0x55dadf679990, _pErrorInfo=0x0) at dbaccess/source/ui/misc/datasourceconnector.cxx:135
#12 0x00007f2737d5ce7a in dbaui::ODatasourceConnector::connect(rtl::OUString const&, dbtools::SQLExceptionInfo*) const
    (this=0x7ffd99aab1b8, _rDataSourceName="file:///home/julien/Documents/testfirebird.odb", _pErrorInfo=0x0) at dbaccess/source/ui/misc/datasourceconnector.cxx:85
#13 0x00007f2737b5a96e in dbaui::OGenericUnoController::connect(rtl::OUString const&, rtl::OUString const&, dbtools::SQLExceptionInfo*)
    (this=0x55dadf690bb0, _rDataSourceName="file:///home/julien/Documents/testfirebird.odb", _rContextInformation="The connection to the data source \"testfirebird\" could not be established.", _pErrorInfo=0x0)
    at dbaccess/source/ui/browser/genericcontroller.cxx:857
#14 0x00007f2737a30fcd in dbaui::OApplicationController::ensureConnection(dbtools::SQLExceptionInfo*) (this=0x55dadf690bb0, _pErrorInfo=0x0) at dbaccess/source/ui/app/AppControllerDnD.cxx:324
#15 0x00007f27379f141c in dbaui::OApplicationController::onContainerSelect(dbaui::ElementType) (this=0x55dadf690bb0, _eType=dbaui::E_TABLE) at dbaccess/source/ui/app/AppController.cxx:1623
#16 0x00007f2737a78839 in dbaui::OApplicationSwapWindow::onContainerSelected(dbaui::ElementType) (this=0x55dadf6836c0, _eType=dbaui::E_TABLE) at dbaccess/source/ui/app/AppSwapWindow.cxx:99
#17 0x00007f2737a78a40 in dbaui::OApplicationSwapWindow::OnContainerSelectHdl(ThumbnailViewItem const*) (this=0x55dadf6836c0, pEntry=0x55dadf524900) at dbaccess/source/ui/app/AppSwapWindow.cxx:117
#18 0x00007f2737a7860d in dbaui::OApplicationSwapWindow::LinkStubOnContainerSelectHdl(void*, ThumbnailViewItem const*) (instance=0x55dadf6836c0, data=0x55dadf524900)
    at dbaccess/source/ui/app/AppSwapWindow.cxx:112
...

second one:
#0  connectivity::firebird::Connection::~Connection() (this=0x55dadfe069f0) at connectivity/source/drivers/firebird/Connection.cxx:103
#1  0x00007f27442f90e9 in connectivity::firebird::Connection::~Connection() (this=0x55dadfe069f0) at connectivity/source/drivers/firebird/Connection.cxx:102
#2  0x00007f2778042f20 in cppu::OWeakObject::release() (this=0x55dadfe069f0) at cppuhelper/source/weak.cxx:230
#3  0x00007f2777f3bcdf in cppu::WeakComponentImplHelperBase::release() (this=0x55dadfe069f0) at cppuhelper/source/implbase.cxx:86
#4  0x00007f27443039d5 in cppu::PartialWeakComponentImplHelper<com::sun::star::document::XDocumentEventListener, com::sun::star::lang::XServiceInfo, com::sun::star::lang::XUnoTunnel, com::sun::star::sdbc::XConnection, com::sun::star::sdbc::XWarningsSupplier>::release() (this=0x55dadfe069f0) at include/cppuhelper/compbase.hxx:86
#5  0x00007f2765106a6d in freeUnoInterfaceProxy(uno_ExtEnvironment*, void*) (pEnv=0x55dadf76b710, pProxy=0x55dadfedfc60) at bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42
#6  0x00007f2779b16920 in (anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1]) (pParam=0x7ffd99aa9a30) at cppu/source/uno/lbenv.cxx:372
#7  0x00007f2779b03fb7 in s_environment_invoke_v(_uno_Environment*, _uno_Environment*, void (*)(__va_list_tag (*) [1]), __va_list_tag (*) [1])
    (pCurrEnv=0x0, pTargetEnv=0x55dadf76b710, pCallee=0x7f2779b16560 <(anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1])>, pParam=0x7ffd99aa9a30) at cppu/source/uno/EnvStack.cxx:293
#8  0x00007f2779b03ed7 in uno_Environment_invoke_v(uno_Environment*, uno_EnvCallee*, va_list*)
    (pTargetEnv=0x55dadf76b710, pCallee=0x7f2779b16560 <(anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1])>, pParam=0x7ffd99aa9a30) at cppu/source/uno/EnvStack.cxx:312
#9  0x00007f2779b040df in uno_Environment_invoke(uno_Environment*, uno_EnvCallee*, ...)
    (pEnv=0x55dadf76b710, pCallee=0x7f2779b16560 <(anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1])>) at cppu/source/uno/EnvStack.cxx:321
#10 0x00007f2779b0ef9a in (anonymous namespace)::defenv_revokeInterface(_uno_ExtEnvironment*, void*) (pEnv=0x55dadf76b710, pInterface=0x55dadfedfc60) at cppu/source/uno/lbenv.cxx:426
#11 0x00007f2765106bb2 in releaseProxy(uno_Interface*) (pUnoI=0x55dadfedfc60) at bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:78
#12 0x00007f275cad0ccb in com::sun::star::uno::UnoInterfaceReference::~UnoInterfaceReference() (this=0x55dadfedfb98) at include/uno/dispatcher.hxx:107
#13 0x00007f275cacc89a in (anonymous namespace)::ProxyRoot::~ProxyRoot() (this=0x55dadfedfb60) at stoc/source/proxy_factory/proxyfac.cxx:132
#14 0x00007f275cacc8d9 in (anonymous namespace)::ProxyRoot::~ProxyRoot() (this=0x55dadfedfb60) at stoc/source/proxy_factory/proxyfac.cxx:132
#15 0x00007f2778042f20 in cppu::OWeakObject::release() (this=0x55dadfedfb60) at cppuhelper/source/weak.cxx:230
#16 0x00007f2778043606 in cppu::OWeakAggObject::release() (this=0x55dadfedfb60) at cppuhelper/source/weak.cxx:296
#17 0x00007f276b9bf2ee in com::sun::star::uno::Reference<com::sun::star::uno::XAggregation>::~Reference() (this=0x55dadfe0c978) at include/com/sun/star/uno/Reference.hxx:114
#18 0x00007f276b9bcd90 in connectivity::OConnectionWrapper::~OConnectionWrapper() (this=0x55dadfe0c960) at connectivity/source/commontools/ConnectionWrapper.cxx:102
#19 0x00007f2746498d0d in dbaccess::OConnection::~OConnection() (this=0x55dadfe0c900) at dbaccess/source/core/dataaccess/connection.cxx:352
#20 0x00007f2746498d69 in dbaccess::OConnection::~OConnection() (this=0x55dadfe0c900) at dbaccess/source/core/dataaccess/connection.cxx:351
#21 0x00007f2778042f20 in cppu::OWeakObject::release() (this=0x55dadfe0c900) at cppuhelper/source/weak.cxx:230
#22 0x00007f27465f2026 in OSubComponent::release() (this=0x55dadfe0c900) at dbaccess/source/core/misc/apitools.cxx:88
#23 0x00007f274649a045 in dbaccess::OConnection::release() (this=0x55dadfe0c900) at dbaccess/source/core/dataaccess/connection.cxx:439
#24 0x00007f2765106a6d in freeUnoInterfaceProxy(uno_ExtEnvironment*, void*) (pEnv=0x55dadf76b710, pProxy=0x55dadff2c660) at bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:42
#25 0x00007f2779b16920 in (anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1]) (pParam=0x7ffd99aaa0d0) at cppu/source/uno/lbenv.cxx:372
#26 0x00007f2779b03fb7 in s_environment_invoke_v(_uno_Environment*, _uno_Environment*, void (*)(__va_list_tag (*) [1]), __va_list_tag (*) [1])
    (pCurrEnv=0x0, pTargetEnv=0x55dadf76b710, pCallee=0x7f2779b16560 <(anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1])>, pParam=0x7ffd99aaa0d0) at cppu/source/uno/EnvStack.cxx:293
#27 0x00007f2779b03ed7 in uno_Environment_invoke_v(uno_Environment*, uno_EnvCallee*, va_list*)
    (pTargetEnv=0x55dadf76b710, pCallee=0x7f2779b16560 <(anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1])>, pParam=0x7ffd99aaa0d0) at cppu/source/uno/EnvStack.cxx:312
#28 0x00007f2779b040df in uno_Environment_invoke(uno_Environment*, uno_EnvCallee*, ...)
    (pEnv=0x55dadf76b710, pCallee=0x7f2779b16560 <(anonymous namespace)::s_stub_defenv_revokeInterface(__va_list_tag (*) [1])>) at cppu/source/uno/EnvStack.cxx:321
#29 0x00007f2779b0ef9a in (anonymous namespace)::defenv_revokeInterface(_uno_ExtEnvironment*, void*) (pEnv=0x55dadf76b710, pInterface=0x55dadff2c660) at cppu/source/uno/lbenv.cxx:426
#30 0x00007f2765106bb2 in releaseProxy(uno_Interface*) (pUnoI=0x55dadff2c660) at bridges/source/cpp_uno/shared/unointerfaceproxy.cxx:78
#31 0x00007f275cad0ccb in com::sun::star::uno::UnoInterfaceReference::~UnoInterfaceReference() (this=0x55dadff35248) at include/uno/dispatcher.hxx:107
#32 0x00007f275cacc89a in (anonymous namespace)::ProxyRoot::~ProxyRoot() (this=0x55dadff35210) at stoc/source/proxy_factory/proxyfac.cxx:132
#33 0x00007f275cacc8d9 in (anonymous namespace)::ProxyRoot::~ProxyRoot() (this=0x55dadff35210) at stoc/source/proxy_factory/proxyfac.cxx:132
#34 0x00007f2778042f20 in cppu::OWeakObject::release() (this=0x55dadff35210) at cppuhelper/source/weak.cxx:230
#35 0x00007f2778043606 in cppu::OWeakAggObject::release() (this=0x55dadff35210) at cppuhelper/source/weak.cxx:296
#36 0x00007f276b9bf2ee in com::sun::star::uno::Reference<com::sun::star::uno::XAggregation>::~Reference() (this=0x55dadfef9468) at include/com/sun/star/uno/Reference.hxx:114
#37 0x00007f276b9bcd90 in connectivity::OConnectionWrapper::~OConnectionWrapper() (this=0x55dadfef9450) at connectivity/source/commontools/ConnectionWrapper.cxx:102
#38 0x00007f27465ef33d in dbaccess::OSharedConnection::~OSharedConnection() (this=0x55dadfef93f0) at dbaccess/source/core/dataaccess/SharedConnection.cxx:37
#39 0x00007f27465ef399 in dbaccess::OSharedConnection::~OSharedConnection() (this=0x55dadfef93f0) at dbaccess/source/core/dataaccess/SharedConnection.cxx:37
#40 0x00007f2778042f20 in cppu::OWeakObject::release() (this=0x55dadfef93f0) at cppuhelper/source/weak.cxx:230
#41 0x00007f2777f3bcdf in cppu::WeakComponentImplHelperBase::release() (this=0x55dadfef93f0) at cppuhelper/source/implbase.cxx:86
#42 0x00007f27465f1835 in cppu::PartialWeakComponentImplHelper<com::sun::star::sdbc::XConnection>::release() (this=0x55dadfef93f0) at include/cppuhelper/compbase.hxx:86
#43 0x00007f27465f04d5 in dbaccess::OSharedConnection::release() (this=0x55dadfef93f0) at dbaccess/source/core/dataaccess/SharedConnection.hxx:52
#44 0x00007f27379fc0ce in com::sun::star::uno::Reference<com::sun::star::sdbc::XConnection>::~Reference() (this=0x55dadf4d7c48) at include/com/sun/star/uno/Reference.hxx:114
--Type <RET> for more, q to quit, c to continue without paging--
#45 0x00007f2737c4e10e in dbaui::OTableTreeListBox::~OTableTreeListBox() (this=0x55dadf4d7aa0) at dbaccess/source/ui/inc/tabletree.hxx:34
#46 0x00007f2737c4e139 in dbaui::OTableTreeListBox::~OTableTreeListBox() (this=0x55dadf4d7aa0) at dbaccess/source/ui/inc/tabletree.hxx:34
#47 0x00007f2737c117fc in std::default_delete<dbaui::TreeListBox>::operator()(dbaui::TreeListBox*) const (this=0x55dadf9fe1a8, __ptr=0x55dadf4d7aa0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99
#48 0x00007f2737c108a3 in std::unique_ptr<dbaui::TreeListBox, std::default_delete<dbaui::TreeListBox> >::~unique_ptr() (this=0x55dadf9fe1a8)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:404
#49 0x00007f2737c0f82b in dbaui::DBTreeViewBase::~DBTreeViewBase() (this=0x55dadf9fe190) at dbaccess/source/ui/control/dbtreelistbox.cxx:503
#50 0x00007f2737c4e165 in dbaui::DBTableTreeView::~DBTableTreeView() (this=0x55dadf9fe190) at dbaccess/source/ui/inc/dbtreelistbox.hxx:157
#51 0x00007f2737c4e189 in dbaui::DBTableTreeView::~DBTableTreeView() (this=0x55dadf9fe190) at dbaccess/source/ui/inc/dbtreelistbox.hxx:157
#52 0x00007f2737a5d31c in std::default_delete<dbaui::DBTreeViewBase>::operator()(dbaui::DBTreeViewBase*) const (this=0x55dadf52a5f8, __ptr=0x55dadf9fe190)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99
#53 0x00007f2737a5d24c in std::__uniq_ptr_impl<dbaui::DBTreeViewBase, std::default_delete<dbaui::DBTreeViewBase> >::reset(dbaui::DBTreeViewBase*) (this=0x55dadf52a5f8, __p=0x0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:211
#54 0x00007f2737a58ced in std::unique_ptr<dbaui::DBTreeViewBase, std::default_delete<dbaui::DBTreeViewBase> >::reset(dbaui::DBTreeViewBase*) (this=0x55dadf52a5f8, __p=0x0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:509
#55 0x00007f2737a4f180 in dbaui::OAppDetailPageHelper::~OAppDetailPageHelper() (this=0x55dadf52a5e0) at dbaccess/source/ui/app/AppDetailPageHelper.cxx:171
#56 0x00007f2737a6c715 in std::destroy_at<dbaui::OAppDetailPageHelper>(dbaui::OAppDetailPageHelper*) (__location=0x55dadf52a5e0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:88
#57 0x00007f2737a6c6f5 in std::_Destroy<dbaui::OAppDetailPageHelper>(dbaui::OAppDetailPageHelper*) (__pointer=0x55dadf52a5e0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_construct.h:149
#58 0x00007f2737a6c52f in std::allocator_traits<std::allocator<void> >::destroy<dbaui::OAppDetailPageHelper>(std::allocator<void>&, dbaui::OAppDetailPageHelper*) (__p=0x55dadf52a5e0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/alloc_traits.h:674
#59 std::_Sp_counted_ptr_inplace<dbaui::OAppDetailPageHelper, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() (this=0x55dadf52a5d0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:613
#60 0x00007f2737a075be in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() (this=0x55dadf52a5d0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:346
#61 0x00007f2737a0753a in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() (this=0x55dadf8d1a00)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1071
#62 0x00007f2737a6c9b9 in std::__shared_ptr<dbaui::OChildWindow, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (this=0x55dadf8d19f8)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr_base.h:1524
#63 0x00007f2737a67bd5 in std::shared_ptr<dbaui::OChildWindow>::~shared_ptr() (this=0x55dadf8d19f8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/shared_ptr.h:175
#64 0x00007f2737a7978d in dbaui::OTitleWindow::~OTitleWindow() (this=0x55dadf8d19d0) at dbaccess/source/ui/app/AppTitleWindow.cxx:40
#65 0x00007f2737a6be1b in std::default_delete<dbaui::OTitleWindow>::operator()(dbaui::OTitleWindow*) const (this=0x55dadf6dbb08, __ptr=0x55dadf8d19d0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99
#66 0x00007f2737a67c53 in std::unique_ptr<dbaui::OTitleWindow, std::default_delete<dbaui::OTitleWindow> >::~unique_ptr() (this=0x55dadf6dbb08)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:404
#67 0x00007f2737a64ee7 in dbaui::OApplicationDetailView::~OApplicationDetailView() (this=0x55dadf6dbad0) at dbaccess/source/ui/app/AppDetailView.cxx:224
#68 0x00007f2737a7e0cb in std::default_delete<dbaui::OApplicationDetailView>::operator()(dbaui::OApplicationDetailView*) const (this=0x55dadf46ced0, __ptr=0x55dadf6dbad0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99
#69 0x00007f2737a7eb8c in std::__uniq_ptr_impl<dbaui::OApplicationDetailView, std::default_delete<dbaui::OApplicationDetailView> >::reset(dbaui::OApplicationDetailView*) (this=0x55dadf46ced0, __p=0x0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:211
#70 0x00007f2737a7d39d in std::unique_ptr<dbaui::OApplicationDetailView, std::default_delete<dbaui::OApplicationDetailView> >::reset(dbaui::OApplicationDetailView*) (this=0x55dadf46ced0, __p=0x0)
    at /usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:509
#71 0x00007f2737a7a718 in dbaui::OAppBorderWindow::dispose() (this=0x55dadf46cd70) at dbaccess/source/ui/app/AppView.cxx:72
#72 0x00007f27709b2a4a in VclReferenceBase::disposeOnce() (this=0x55dadf46cee0) at vcl/source/outdev/vclreferencebase.cxx:38
#73 0x00007f2737a7d766 in VclPtr<dbaui::OAppBorderWindow>::disposeAndClear() (this=0x55dadf528258) at include/vcl/vclptr.hxx:207
#74 0x00007f2737a7b0c3 in dbaui::OApplicationView::dispose() (this=0x55dadf528210) at dbaccess/source/ui/app/AppView.cxx:114
#75 0x00007f27709b2a4a in VclReferenceBase::disposeOnce() (this=0x55dadf528268) at vcl/source/outdev/vclreferencebase.cxx:38
#76 0x00007f277255c349 in VclPtr<vcl::Window>::disposeAndClear() (this=0x7ffd99aab058) at include/vcl/vclptr.hxx:207
#77 0x00007f277254d089 in VCLXWindow::dispose() (this=0x55dadf970d20) at toolkit/source/awt/vclxwindow.cxx:927
#78 0x00007f2777209a54 in (anonymous namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) (this=0x55dadf109c90, xComponentWindow=uno::Reference to (VCLXWindow *) 0x55dadfaa16f0, xController=uno::Reference to ((anonymous namespace)::BackingComp *) 0x55dadfd82088)
    at framework/source/services/frame.cxx:1522
--Type <RET> for more, q to quit, c to continue without paging--
#79 0x00007f277701ccb8 in framework::CloseDispatcher::implts_establishBackingMode() (this=0x55dadfa4eb20) at framework/source/dispatch/closedispatcher.cxx:535
#80 0x00007f277701c038 in framework::CloseDispatcher::impl_asyncCallback(LinkParamNone*) (this=0x55dadfa4eb20) at framework/source/dispatch/closedispatcher.cxx:403
#81 0x00007f277701a3ed in framework::CloseDispatcher::LinkStubimpl_asyncCallback(void*, LinkParamNone*) (instance=0x55dadfa4eb20, data=0x0) at framework/source/dispatch/closedispatcher.cxx:246
...
So a bit difficult to follow the logic here.

2) I added acquire and release methods on Firebird driver and noticed that when opening a Firebird embedded odb (+ displaying tables to call the FB driver) then closing LO entirely, I got:
6 calls of acquire in FB driver
but only 5 calls of release

after some debugging, it seems the second acquire has no release counterpart.

Then I tried to find where's the release missing but haven't found it yet but I guess this would help.

There's not much unique_ptr use in this part of code, above all uno::Reference.

I tried Valgrind, no hint from the trace.

If someone has some idea to test...
Comment 7 Commit Notification 2023-10-18 07:50:45 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/502fbd79f9d71d01a177c3cd77256ed6a5a544d8

Related tdf#144256: fix order of disposing in OSharedConnection

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2023-10-19 05:45:58 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1c15934170341bbcfb4671fdbb01c2259265b3e1

Related tdf#144256: remove m_pSharedConnectionManager

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2023-10-19 16:21:16 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7f3ab74eb62ec83d6fc4432979654944f27de7b4

Related tdf#144256: missing removePropertyChangeListener calls in AppController

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.