• Michael Stahl's avatar
    stoc: deadlock osl::Mutex::getGlobalMutex() vs getImplHelperInitMutex() · 7936368f
    Michael Stahl yazdı
    As found in a clang/ASAN build running UITest_writer_demo.
    
    cppu::getTypeEntries locks getImplHelperInitMutex().
    
    Let's try to replace the usage of getGlobalMutex() in proxyfac_create()
    with a new static Mutex that is only used in that function.
    
    {1: 7, 6: 1, 7: 1}
    Thread 1 is waiting for 7
    Thread 7 is waiting for 1
    
    Thread 7 (Thread 0x7f34a147a700 (LWP 2530)):
    2  osl_acquireMutex(oslMutexImpl*) (pMutex=0x7f34f620a3e0 <globalMutexImpl>) at sal/osl/unx/mutex.cxx:97
    3  osl::Mutex::acquire() (this=0x7f34f61f7da0 <osl_getGlobalMutex::globalMutex>) at include/osl/mutex.hxx:56
    4  osl::Guard<osl::Mutex>::Guard(osl::Mutex*) (this=0x7f349f6dc420, pT_=0x7f34f61f7da0 <osl_getGlobalMutex::globalMutex>) at include/osl/mutex.hxx:122
    5  com::sun::star::lang::cppu_detail_getUnoType(com::sun::star::lang::XSingleComponentFactory const*) () at workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/lang/XSingleComponentFactory.hpp:69
    6  cppu::UnoType<com::sun::star::lang::XSingleComponentFactory>::get() () at include/cppu/unotype.hxx:296
    7  com::sun::star::lang::XSingleComponentFactory::static_type(void*) () at workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/lang/XSingleComponentFactory.hpp:146
    8  cppu::getTypeEntries(cppu::class_data*) (cd=0x7f34bddacb40 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>, com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>::operator()()::s_cd>) at cppuhelper/source/implbase_ex.cxx:96
    9  cppu::queryDeepNoXInterface(_typelib_TypeDescriptionReference const*, cppu::class_data*, void*) (pDemandedTDR=0x60f000042940, cd=0x7f34bddacb40 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>, com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>::operator()()::s_cd>, that=0x606000d3d3c0) at cppuhelper/source/implbase_ex.cxx:168
    10 cppu::WeakImplHelper_query(com::sun::star::uno::Type const&, cppu::class_data*, void*, cppu::OWeakObject*) (rType=invalid uno::Type, cd=0x7f34bddacb40 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>, com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>::operator()()::s_cd>, that=0x606000d3d3c0, pBase=0x606000d3d3c0) at cppuhelper/source/implbase_ex.cxx:296
    11 cppu::WeakImplHelper<com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>::queryInterface(com::sun::star::uno::Type const&) (this=0x606000d3d3c0, aType=invalid uno::Type) at include/cppuhelper/implbase.hxx:108
    12 non-virtual thunk to cppu::WeakImplHelper<com::sun::star::lang::XSingleComponentFactory, com::sun::star::lang::XServiceInfo>::queryInterface(com::sun::star::uno::Type const&) () at include/cppuhelper/implbase.hxx:107
    13 com::sun::star::uno::BaseReference::iquery(com::sun::star::uno::XInterface*, com::sun::star::uno::Type const&) (pInterface=0x606000d3d3e8, rType=invalid uno::Type) at include/com/sun/star/uno/Reference.hxx:55
    14 com::sun::star::uno::Reference<com::sun::star::lang::XSingleComponentFactory>::iquery(com::sun::star::uno::XInterface*) (pInterface=0x606000d3d3e8) at include/com/sun/star/uno/Reference.hxx:70
    15 com::sun::star::uno::Reference<com::sun::star::lang::XSingleComponentFactory>::set(com::sun::star::uno::BaseReference const&, com::sun::star::uno::UnoReference_Query) (this=0x7f349f92b7e0, rRef=...) at include/com/sun/star/uno/Reference.hxx:279
    16 cppuhelper::ServiceManager::loadImplementation(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, std::shared_ptr<cppuhelper::ServiceManager::Data::Implementation> const&) (this=0x61500000e900, context=uno::Reference to (cppu::ComponentContext *) 0x611000003b50, implementation=warning: RTTI symbol not found for class 'std::_Sp_counted_ptr<cppuhelper::ServiceManager::Data::Implementation*, (__gnu_cxx::_Lock_policy)2>'
    arnound for class 'std::_Sp_counted_ptr<cppuhelper::ServiceManager::Data::Implementation*, (__gnu_cxx::_Lock_policy)2>'
    td:weak 0) 0x60b000013ff0) at cppuhelper/source/servicemanager.cxx:823
    17 cppuhelper::ServiceManager::findServiceImplementation(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, rtl::OUString const&) (this=0x61500000e900, context=uno::Reference to (cppu::ComponentContext *) 0x611000003b50, specifier="com.sun.star.configuration.ConfigurationProvider") at cppuhelper/source/servicemanager.cxx:1811
    18 cppuhelper::ServiceManager::createInstanceWithContext(rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x61500000e900, aServiceSpecifier="com.sun.star.configuration.ConfigurationProvider", Context=uno::Reference to (cppu::ComponentContext *) 0x611000003b50) at cppuhelper/source/servicemanager.cxx:993
    19 cppuhelper::ServiceManager::createInstance(rtl::OUString const&) (this=0x61500000e900, aServiceSpecifier="com.sun.star.configuration.ConfigurationProvider") at cppuhelper/source/servicemanager.cxx:950
    
    Thread 1 (Thread 0x7f34f632b4c0 (LWP 2487)):
    2  osl_acquireMutex(oslMutexImpl*) (pMutex=0x604000098a90) at sal/osl/unx/mutex.cxx:97
    3  osl::Mutex::acquire() (this=0x7f34f12fa820 <rtl::Static<osl::Mutex, (anonymous namespace)::theImplHelperInitMutex>::get()::instance>) at include/osl/mutex.hxx:56
    4  osl::Guard<osl::Mutex>::Guard(osl::Mutex&) (this=0x7f34c6611420, t=...) at include/osl/mutex.hxx:129
    5  cppu::getTypeEntries(cppu::class_data*) (cd=0x7f3498adf290 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::lang::XServiceInfo, com::sun::star::reflection::XProxyFactory>, com::sun::star::lang::XServiceInfo, com::sun::star::reflection::XProxyFactory>::operator()()::s_cd>) at cppuhelper/source/implbase_ex.cxx:89
    6  cppu::queryDeepNoXInterface(_typelib_TypeDescriptionReference const*, cppu::class_data*, void*) (pDemandedTDR=0x60f00003c6d0, cd=0x7f3498adf290 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::lang::XServiceInfo, com::sun::star::reflection::XProxyFactory>, com::sun::star::lang::XServiceInfo, com::sun::star::reflection::XProxyFactory>::operator()()::s_cd>, that=0x6080005aa620) at cppuhelper/source/implbase_ex.cxx:168
    7  cppu::WeakImplHelper_query(com::sun::star::uno::Type const&, cppu::class_data*, void*, cppu::OWeakObject*) (rType=invalid uno::Type, cd=0x7f3498adf290 <cppu::detail::ImplClassData<cppu::WeakImplHelper<com::sun::star::lang::XServiceInfo, com::sun::star::reflection::XProxyFactory>, com::sun::star::lang::XServiceInfo, com::sun::star::reflection::XProxyFactory>::operator()()::s_cd>, that=0x6080005aa620, pBase=0x6080005aa620) at cppuhelper/source/implbase_ex.cxx:296
    8  cppu::WeakImplHelper<com::sun::star::lang::XServiceInfo, com::sun::star::reflection::XProxyFactory>::queryInterface(com::sun::star::uno::Type const&) (this=0x6080005aa620, aType=invalid uno::Type) at include/cppuhelper/implbase.hxx:108
    9  com::sun::star::uno::BaseReference::iquery(com::sun::star::uno::XInterface*, com::sun::star::uno::Type const&) (pInterface=0x6080005aa620, rType=invalid uno::Type) at include/com/sun/star/uno/Reference.hxx:55
    10 com::sun::star::uno::Reference<com::sun::star::uno::XWeak>::iquery(com::sun::star::uno::XInterface*) (pInterface=0x6080005aa620) at include/com/sun/star/uno/Reference.hxx:70
    11 com::sun::star::uno::Reference<com::sun::star::uno::XWeak>::query(com::sun::star::uno::BaseReference const&) (rRef=...) at include/com/sun/star/uno/Reference.hxx:371
    12 com::sun::star::uno::OWeakRefListener::OWeakRefListener(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (this=0x603000e789b0, xInt=uno::Reference to ((anonymous namespace)::FactoryImpl *) 0x6080005aa620) at cppuhelper/source/weak.cxx:371
    13 com::sun::star::uno::WeakReferenceHelper::operator=(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (this=0x7f3498ae06e0 <(anonymous namespace)::proxyfac_create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)::rwInstance>, xInt=uno::Reference to ((anonymous namespace)::FactoryImpl *) 0x6080005aa620) at cppuhelper/source/weak.cxx:500
    14 com::sun::star::uno::WeakReference<com::sun::star::uno::XInterface>::operator=(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const&) (this=0x7f3498ae06e0 <(anonymous namespace)::proxyfac_create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)::rwInstance>, xInt=uno::Reference to ((anonymous namespace)::FactoryImpl *) 0x6080005aa620) at include/cppuhelper/weakref.hxx:173
    15 (anonymous namespace)::proxyfac_create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) () at stoc/source/proxy_factory/proxyfac.cxx:443
    16 cppu::OSingleFactoryHelper::createInstanceEveryTime(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x61000031cfa8, xContext=uno::Reference to (cppu::ComponentContext *) 0x611000003b50) at cppuhelper/source/factory.cxx:140
    17 cppu::OSingleFactoryHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x61000031cfa8, xContext=uno::Reference to (cppu::ComponentContext *) 0x611000003b50) at cppuhelper/source/factory.cxx:175
    18 cppu::OFactoryComponentHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) (this=0x61000031cf40, xContext=uno::Reference to (cppu::ComponentContext *) 0x611000003b50) at cppuhelper/source/factory.cxx:378
    19 non-virtual thunk to cppu::OFactoryComponentHelper::createInstanceWithContext(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) () at cppuhelper/source/factory.cxx:364
    20 0x00007f34f0e6d166 in cppuhelper::ServiceManager::Data::Implementation::createInstance(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&, bool) (this=0x60b000001850, context=uno::Reference to (cppu::ComponentContext *) 0x611000003b50, singletonRequest=false) at cppuhelper/source/servicemanager.cxx:668
    
    Change-Id: I8d10cca4965feb704c35c70cf99995be26e23a41
    7936368f
Adı
Son kayıt (commit)
Son güncelleme
..
corereflection Loading commit data...
defaultregistry Loading commit data...
implementationregistration Loading commit data...
inspect Loading commit data...
invocation Loading commit data...
invocation_adapterfactory Loading commit data...
javaloader Loading commit data...
javavm Loading commit data...
loader Loading commit data...
namingservice Loading commit data...
proxy_factory Loading commit data...
security Loading commit data...
servicemanager Loading commit data...
simpleregistry Loading commit data...
typeconv Loading commit data...
uriproc Loading commit data...