Bug 57979 - ODatabaseContext::dispose uses other services during shutdown
Summary: ODatabaseContext::dispose uses other services during shutdown
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
4.0.0.0.alpha0+ Master
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 101734 (view as bug list)
Depends on:
Blocks: Dev-related
  Show dependency treegraph
 
Reported: 2012-12-07 11:13 UTC by Stephan Bergmann
Modified: 2023-07-09 13:20 UTC (History)
3 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 Stephan Bergmann 2012-12-07 11:13:31 UTC
At least reproducible with current Linux x86-64 --enable-dbugtil master build: "File - New - Database", "Finish", save, "Reports - Use Wizard to Create Report...", "Cancel", "File - Exit LibreOffice" reports

> warn:legacy.osl:9105:1:lo/core/dbaccess/source/core/dataaccess/ModelImpl.cxx:924: caught an exception!
> in function:static bool dbaccess::ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors(const com::sun::star::uno::Reference<com::sun::star::embed::XStorage>&)
> type: com.sun.star.uno.DeploymentException
> message: component context fails to supply service com.sun.star.io.TempFile of type com.sun.star.io.XTempFile
> context: N4cppu16ComponentContextE

on stderr, coming from

> #0  0x00007fffa3ba44e5 in dbaccess::ODatabaseModelImpl::commitStorageIfWriteable_ignoreErrors (_rxStorage=uno::Reference to {<com::sun::star::container::XNameAccess> = {<com::sun::star::container::XElementAccess> = {<com::sun::star::uno::XInterface> = {_vptr.XInterface = 0x7fffb42ded10}, <No data fields>}, <No data fields>}, <com::sun::star::lang::XComponent> = {<com::sun::star::uno::XInterface> = {_vptr.XInterface = 0x7fffb42def80}, <No data fields>}, <No data fields>}) at lo/core/dbaccess/source/core/dataaccess/ModelImpl.cxx:924
> #1  0x00007fffa3ba371a in dbaccess::ODatabaseModelImpl::commitRootStorage (this=0x4af4af0) at lo/core/dbaccess/source/core/dataaccess/ModelImpl.cxx:828
> #2  0x00007fffa3ba208c in dbaccess::ODatabaseModelImpl::dispose (this=0x4af4af0) at lo/core/dbaccess/source/core/dataaccess/ModelImpl.cxx:741
> #3  0x00007fffa3b16565 in dbaccess::ODatabaseContext::disposing (this=0x7fffb4866258) at lo/core/dbaccess/source/core/dataaccess/databasecontext.cxx:290
> #4  0x00007ffff70258ba in cppu::WeakComponentImplHelperBase::dispose (this=0x7fffb4866258) at lo/core/cppuhelper/source/implbase.cxx:268
> #5  0x00007fffa3b25a52 in cppu::WeakComponentImplHelper3<com::sun::star::lang::XServiceInfo, com::sun::star::sdb::XDatabaseContext, com::sun::star::lang::XUnoTunnel>::dispose (this=0x7fffb4866258) at lo/core/solver/unxlngx6/inc/cppuhelper/compbase3.hxx:66
> #6  0x00007ffff701e8b0 in cppu::OFactoryComponentHelper::dispose (this=0x7fffb459d018) at lo/core/cppuhelper/source/factory.cxx:514
> #7  0x00007ffff6fda888 in cppu::OComponentHelper::release (this=0x7fffb459d018) at lo/core/cppuhelper/source/component.cxx:91
> #8  0x00007ffff70234e8 in cppu::OFactoryComponentHelper::release (this=0x7fffb459d018) at lo/core/cppuhelper/source/factory.cxx:334
> #9  0x00007ffff6fd601b in com::sun::star::uno::Reference<com::sun::star::lang::XSingleComponentFactory>::~Reference (this=0x7386e0, __in_chrg=<optimized out>) at lo/core/solver/unxlngx6/inc/com/sun/star/uno/Reference.hxx:108
> #10 0x00007ffff6ff9ea9 in (anonymous namespace)::Implementation::~Implementation (this=0x7386d0, __in_chrg=<optimized out>) at lo/core/cppuhelper/source/defaultbootstrap.cxx:150
> #11 0x00007ffff6ff9f02 in boost::checked_delete<{anonymous}::Implementation>((anonymous namespace)::Implementation *) (x=0x7386d0) at lo/core/solver/unxlngx6/inc/external/boost/checked_delete.hpp:34
> #12 0x00007ffff7000cb8 in boost::detail::sp_counted_impl_p<{anonymous}::Implementation>::dispose(void) (this=0x7387e0) at lo/core/solver/unxlngx6/inc/external/boost/smart_ptr/detail/sp_counted_impl.hpp:78
> #13 0x00007ffff7001300 in boost::detail::sp_counted_base::release (this=0x7387e0) at lo/core/solver/unxlngx6/inc/external/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:145
> #14 0x00007ffff700138f in boost::detail::shared_count::~shared_count (this=0x738830, __in_chrg=<optimized out>) at lo/core/solver/unxlngx6/inc/external/boost/smart_ptr/detail/shared_count.hpp:217
> #15 0x00007ffff6fde03c in boost::shared_ptr<{anonymous}::Implementation>::~shared_ptr(void) (this=0x738828, __in_chrg=<optimized out>) at lo/core/solver/unxlngx6/inc/external/boost/smart_ptr/shared_ptr.hpp:168
> #16 0x00007ffff6fe0151 in std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >::~pair(void) (this=0x738820, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_pair.h:88
> #17 0x00007ffff6ffea5e in std::_Rb_tree_node<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >::~_Rb_tree_node(void) (this=0x738800, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:130
> #18 0x00007ffff6ffea7c in __gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::destroy<std::_Rb_tree_node<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >(std::_Rb_tree_node<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > *) (this=0x7fffffffdcf0, __p=0x738800) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/ext/new_allocator.h:114
> #19 0x00007ffff6ffc5fb in std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_M_destroy_node(std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_Link_type) (this=0x7fffffffdcf0, __p=0x738800) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:419
> #20 0x00007ffff6ff8a15 in std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_M_erase(std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_Link_type) (this=0x7fffffffdcf0, __x=0x738800) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:1084
> #21 0x00007ffff6ff89f2 in std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_M_erase(std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_Link_type) (this=0x7fffffffdcf0, __x=0x7385e0) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:1082
> #22 0x00007ffff6ff89f2 in std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_M_erase(std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_Link_type) (this=0x7fffffffdcf0, __x=0x6e52b0) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:1082
> #23 0x00007ffff6ff89f2 in std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_M_erase(std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_Link_type) (this=0x7fffffffdcf0, __x=0x6db140) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:1082
> #24 0x00007ffff6ff89f2 in std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_M_erase(std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::_Link_type) (this=0x7fffffffdcf0, __x=0x6e8790) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:1082
> #25 0x00007ffff6ff45e8 in std::_Rb_tree<rtl::OUString, std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> >, std::_Select1st<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > >, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::~_Rb_tree(void) (this=0x7fffffffdcf0, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:646
> #26 0x00007ffff6fef3a8 in std::__cxx1998::map<rtl::OUString, boost::shared_ptr<{anonymous}::Implementation>, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::~map(void) (this=0x7fffffffdcf0, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/stl_map.h:90
> #27 0x00007ffff6fef444 in std::__debug::map<rtl::OUString, boost::shared_ptr<{anonymous}::Implementation>, std::less<rtl::OUString>, std::allocator<std::pair<const rtl::OUString, boost::shared_ptr<{anonymous}::Implementation> > > >::~map(void) (this=0x7fffffffdcf0, __in_chrg=<optimized out>) at /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/debug/map.h:107
> #28 0x00007ffff6fe14aa in (anonymous namespace)::Data::~Data (this=0x7fffffffdcf0, __in_chrg=<optimized out>) at lo/core/cppuhelper/source/defaultbootstrap.cxx:229
> #29 0x00007ffff6fe5b5e in (anonymous namespace)::ServiceManager::disposing (this=0x7fffe6a02208) at lo/core/cppuhelper/source/defaultbootstrap.cxx:1369
> #30 0x00007ffff70258ba in cppu::WeakComponentImplHelperBase::dispose (this=0x7fffe6a02208) at lo/core/cppuhelper/source/implbase.cxx:268
> #31 0x00007ffff701b860 in cppu::WeakComponentImplHelper8<com::sun::star::lang::XServiceInfo, com::sun::star::lang::XMultiServiceFactory, com::sun::star::lang::XMultiComponentFactory, com::sun::star::container::XSet, com::sun::star::container::XContentEnumerationAccess, com::sun::star::beans::XPropertySet, com::sun::star::beans::XPropertySetInfo, com::sun::star::lang::XEventListener>::dispose (this=0x7fffe6a02208) at lo/core/solver/unxlngx6/inc/cppuhelper/compbase8.hxx:66
> #32 0x00007ffff6fc8e95 in cppu::try_dispose (xInstance=uno::Reference to {_vptr.XInterface = 0x7ffff7306308}) at lo/core/cppuhelper/source/component_context.cxx:276
> #33 0x00007ffff6fcb47a in cppu::ComponentContext::disposing (this=0x7fffe69dd858) at lo/core/cppuhelper/source/component_context.cxx:745
> #34 0x00007ffff70258ba in cppu::WeakComponentImplHelperBase::dispose (this=0x7fffe69dd858) at lo/core/cppuhelper/source/implbase.cxx:268
> #35 0x00007ffff6fda10e in cppu::WeakComponentImplHelper2<com::sun::star::uno::XComponentContext, com::sun::star::container::XNameContainer>::dispose (this=0x7fffe69dd858) at lo/core/solver/unxlngx6/inc/cppuhelper/compbase2.hxx:66
> #36 0x00007ffff7a89459 in desktop::Desktop::DeInit (this=0x7fffffffe430) at lo/core/desktop/source/app/app.cxx:627
> #37 0x00007ffff32f1f31 in DeInitVCL () at lo/core/vcl/source/app/svmain.cxx:494
> #38 0x00007ffff32f119b in ImplSVMain () at lo/core/vcl/source/app/svmain.cxx:186
> #39 0x00007ffff32f11f8 in SVMain () at lo/core/vcl/source/app/svmain.cxx:199
> #40 0x00007ffff7acdccb in soffice_main () at lo/core/desktop/source/app/sofficemain.cxx:74
> #41 0x0000000000400948 in sal_main () at lo/core/desktop/source/app/main.c:48
> #42 0x0000000000400929 in main (argc=1, argv=0x7fffffffe618) at lo/core/desktop/source/app/main.c:47

As ODatabaseContext is a single-instance implementation (see use of cppu::createOneInstanceComponentFactory in dbaccess/soruce/misc/services.cxx), it is only disposed when the global service manager is disposed, but after the global service manager has cleaned its tables so that it no longer provides any services.

So either ODatabaseContext should not do substantial work during dispose (which is best not to do, anyway) or should be changed to destroy implementation(s) as soon as they are no longer referenced by client code (i.e., not use cppu::createOneInstanceComponentFactory).
Comment 1 Rich R 2014-08-14 18:57:54 UTC
I installed via apt, so not sure how to do that.  Should I try installing a downloaded version instead?
Comment 2 Rich R 2014-08-14 19:16:58 UTC Comment hidden (off-topic)
Comment 3 Rich R 2014-08-14 19:17:54 UTC Comment hidden (off-topic)
Comment 4 Alex Thurgood 2015-01-03 17:39:27 UTC Comment hidden (no-value)
Comment 5 QA Administrators 2016-01-17 20:04:45 UTC Comment hidden (obsolete)
Comment 6 Julien Nabet 2016-12-20 18:54:58 UTC
*** Bug 101734 has been marked as a duplicate of this bug. ***
Comment 7 Alex Thurgood 2016-12-21 11:23:16 UTC
So, confirming that this is still an issue with current master build
Comment 8 QA Administrators 2017-12-22 03:35:17 UTC Comment hidden (obsolete)
Comment 9 Julien Nabet 2018-01-27 22:33:38 UTC
Just to respond to QA Admin message, on pc Debian x86-64 with master sources updated today, I could reproduce this.

(now the file services.cxx is in dbaccess/source/core/misc)
Comment 10 QA Administrators 2019-01-28 03:42:21 UTC Comment hidden (obsolete)
Comment 11 QA Administrators 2021-01-28 04:17:45 UTC Comment hidden (obsolete)
Comment 12 Julien Nabet 2021-12-27 16:40:48 UTC
On pc Debian x86-64 with master sources updated today, I confirm I still got this:
warn:vcl.schedule.deinit:63545:63545:vcl/source/app/scheduler.cxx:177: DeInit task: Timer a: 1 p: 1 drawinglayer ImpTimedRefDev destroy mpVirDev 180000ms (0x438e530)
warn:vcl.schedule.deinit:63545:63545:vcl/source/app/scheduler.cxx:177: DeInit task: Timer a: 1 p: 1 graphic::Manager maSwapOutTimer 10000ms (0x7fbb152416c0)
warn:vcl.schedule.deinit:63545:63545:vcl/source/app/scheduler.cxx:198: DeInit active tasks: 2 (ignored: 0)
warn:dbaccess:63545:63545:dbaccess/source/core/dataaccess/ModelImpl.cxx:862: DBG_UNHANDLED_EXCEPTION in commitStorageIfWriteable_ignoreErrors exception: com.sun.star.uno.DeploymentException message: component context fails to supply service com.sun.star.io.TempFile of type com.sun.star.io.XTempFile /home/julien/lo/libreoffice/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/io/TempFile.hpp:46
warn:dbaccess:63545:63545:dbaccess/source/core/dataaccess/ModelImpl.cxx:923:  com.sun.star.uno.DeploymentException message: component context fails to supply service com.sun.star.security.DocumentDigitalSignatures of type com.sun.star.security.XDocumentDigitalSignatures /home/julien/lo/libreoffice/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/security/DocumentDigitalSignatures.hpp:80
warn:dbaccess:63545:63545:dbaccess/source/core/dataaccess/ModelImpl.cxx:749: ODatabaseModelImpl::commitRootStorage: could not commit the storage!
warn:legacy.osl:63545:63545:dbaccess/source/core/dataaccess/databasecontext.cxx:495: ODatabaseContext::storeTransientProperties: a non-empty data source which I do not know?!
warn:unotools.config:63545:63545:unotools/source/config/configmgr.cxx:147: ConfigManager not empty
Comment 13 Julien Nabet 2021-12-27 16:47:39 UTC
find . -name services.cxx gives:
./reportdesign/source/core/api/services.cxx
./framework/qa/cppunit/services.cxx
./postprocess/qa/services.cxx

so nowhere to be seen in dbaccess.

git grep -n createOneInstanceComponentFactory gives:
cppuhelper/source/factory.cxx:954:Reference< lang::XSingleComponentFactory > SAL_CALL createOneInstanceComponentFactory(
cppuhelper/source/gcc3.map:401:        _ZN4cppu33createOneInstanceComponentFactoryEPFN3com3sun4star3uno9ReferenceINS3_10XInterfaceEEERKNS4_INS3_17XComponentContextEEEERKN3rtl8OUStringERKNS3_8SequenceISE_EEP16_rtl_ModuleCount;
include/cppuhelper/factory.hxx:163:createOneInstanceComponentFactory(

I thought first it could be removed but it seems to be a public API.
/** Creates a single service factory which holds the instance created only once.

    @param fptr function pointer for instantiating the object
    @param rImplementationName implementation name of service
    @param rServiceNames supported services
    @param pModCount a backwards-compatibility remainder of a removed library
           unloading feature; always set to null

    @see createSingleComponentFactory
*/
CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL
createOneInstanceComponentFactory(
    ComponentFactoryFunc fptr,
    ::rtl::OUString const & rImplementationName,
    css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
    rtl_ModuleCount * pModCount = NULL );

See https://opengrok.libreoffice.org/xref/core/cppuhelper/source/factory.cxx?r=2484de67&mo=30255&fi=954#954

I think tackling this one may help for some Base bugs.