Issue 117119 - lock-order violation in comprehensive cppu_detail_getUnoType
Summary: lock-order violation in comprehensive cppu_detail_getUnoType
Status: CLOSED FIXED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: DEV300m100
Hardware: All All
: P3 Normal (vote)
Target Milestone: ---
Assignee: Stephan Bergmann
QA Contact: issues@udk
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-28 10:40 UTC by Stephan Bergmann
Modified: 2017-05-20 09:24 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stephan Bergmann 2011-02-28 10:40:14 UTC
At least on DEV300_m101 based CWS sb140, unxlngx6 non-pro, running soffice under valgrind --tool=helgrind with an org.openofice.test.OfficeConnection-based test that simply calls OfficeConnection.setUp() immediately followed by OfficeConnection.tearDown(), valgrind reports

Thread #1: lock order "0xE94F930 before 0x5248BA0" violated
   at 0x4C2BC62: pthread_mutex_lock (valgrind-3.6.1/helgrind/hg_intercepts.c:496)
   by 0x4E61A1B: osl_acquireMutex (ooo/sal/osl/unx/mutex.c:129)
   by 0x6FEF9DD: osl::Mutex::acquire() (unxlngx6/inc/osl/mutex.hxx:66)
   by 0x6FEFA34: osl::Guard<osl::Mutex>::Guard(osl::Mutex&) (unxlngx6/inc/osl/mutex.hxx:152)
   by 0x6FF2CEE: typelib_static_type_getByTypeClass (ooo/cppu/source/typelib/static_types.cxx:151)
   by 0x6D22F08: cppu::detail::getTypeFromTypeClass(_typelib_TypeClass) (unxlngx6/inc/cppu/unotype.hxx:111)
   by 0x6D24E4D: cppu::detail::cppu_detail_getUnoType(com::sun::star::uno::XInterface const*) (unxlngx6/inc/cppu/unotype.hxx:231)
   by 0x6D24E5D: cppu::UnoType<com::sun::star::uno::XInterface>::get() (unxlngx6/inc/cppu/unotype.hxx:269)
   by 0x6D24E70: com::sun::star::uno::Type const& cppu::detail::cppu_detail_getUnoType<com::sun::star::uno::XInterface>(com::sun::star::uno::Reference<com::sun::star::uno::XInterface> const*) (unxlngx6/inc/cppu/unotype.hxx:236)
   by 0x6D24E81: cppu::UnoType<com::sun::star::uno::Reference<com::sun::star::uno::XInterface> >::get() (unxlngx6/inc/cppu/unotype.hxx:269)
   by 0x6D2BAE6: com::sun::star::lang::cppu_detail_getUnoType(com::sun::star::lang::XMultiServiceFactory const*) (ooo/cppuhelper/source/../unxlngx6/inc/cppuhelper/com/sun/star/lang/XMultiServiceFactory.hpp:34)
   by 0x6D2C423: cppu::UnoType<com::sun::star::lang::XMultiServiceFactory>::get() (unxlngx6/inc/cppu/unotype.hxx:269)
   by 0x6D2C436: com::sun::star::uno::Type const& cppu::detail::cppu_detail_getUnoType<com::sun::star::lang::XMultiServiceFactory>(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const*) (unxlngx6/inc/cppu/unotype.hxx:236)
   by 0x6D2C447: cppu::UnoType<com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> >::get() (unxlngx6/inc/cppu/unotype.hxx:269)
   by 0x6D2C45A: getCppuType(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const*) (ooo/cppuhelper/source/../unxlngx6/inc/cppuhelper/com/sun/star/lang/XMultiServiceFactory.hpp:143)
   by 0x6D76142: cppu::loadSharedLibComponentFactory(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&, com::sun::star::uno::Reference<com::sun::star::registry::XRegistryKey> const&) (ooo/cppuhelper/source/shlib.cxx:413)
   by 0x6D25F9D: cppu::bootstrapInitialSF(rtl::OUString const&) (ooo/cppuhelper/source/servicefactory.cxx:337)
   by 0x6D3D302: cppu::(anonymous namespace)::defaultBootstrap_InitialComponentContext(rtl::Bootstrap const&) (ooo/cppuhelper/source/bootstrap.cxx:395)
   by 0x6D3DEF8: cppu::defaultBootstrap_InitialComponentContext() (ooo/cppuhelper/source/bootstrap.cxx:477)
   by 0x528BBD9: desktop::Desktop::CreateApplicationServiceManager() (ooo/desktop/source/app/appinit.cxx:213)
   by 0x5279EE2: desktop::Desktop::Init() (ooo/desktop/source/app/app.cxx:739)
   by 0x994EC82: InitVCL(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> const&) (ooo/vcl/source/app/svmain.cxx:319)
   by 0x994F07B: ImplSVMain() (ooo/vcl/source/app/svmain.cxx:183)
   by 0x994F1E6: SVMain() (ooo/vcl/source/app/svmain.cxx:226)
   by 0x52AA27B: soffice_main (ooo/desktop/source/app/sofficemain.cxx:49)
   by 0x401192: sal_main (ooo/desktop/source/app/main.c:35)
   by 0x401177: main (ooo/desktop/source/app/main.c:34)
  Required order was established by acquisition of lock at 0xE94F930
   at 0x4C2BC62: pthread_mutex_lock (valgrind-3.6.1/helgrind/hg_intercepts.c:496)
   by 0x4E61A1B: osl_acquireMutex (ooo/sal/osl/unx/mutex.c:129)
   by 0x6FEF9DD: osl::Mutex::acquire() (unxlngx6/inc/osl/mutex.hxx:66)
   by 0x6FEFA34: osl::Guard<osl::Mutex>::Guard(osl::Mutex&) (unxlngx6/inc/osl/mutex.hxx:152)
   by 0x6FF2CEE: typelib_static_type_getByTypeClass (ooo/cppu/source/typelib/static_types.cxx:151)
   by 0x15E3E90C: cppu::detail::getTypeFromTypeClass(_typelib_TypeClass) (unxlngx6/inc/cppu/unotype.hxx:111)
   by 0x15E3E92D: cppu::detail::cppu_detail_getUnoType(rtl::OUString const*) (unxlngx6/inc/cppu/unotype.hxx:194)
   by 0x15E3E93D: cppu::UnoType<rtl::OUString>::get() (unxlngx6/inc/cppu/unotype.hxx:269)
   by 0x15E469CC: com::sun::star::uno::Type const& cppu::getTypeFavourUnsigned<rtl::OUString>(rtl::OUString const*) (unxlngx6/inc/cppu/unotype.hxx:290)
   by 0x15E469F4: com::sun::star::uno::Type const& cppu::getTypeFavourUnsigned<rtl::OUString>(com::sun::star::uno::Sequence<rtl::OUString> const*) (unxlngx6/inc/com/sun/star/uno/Sequence.hxx:228)
   by 0x15E46A36: com::sun::star::uno::Sequence<rtl::OUString>::Sequence(rtl::OUString const*, int) (unxlngx6/inc/com/sun/star/uno/Sequence.hxx:82)
   by 0x15E4A366: __static_initialization_and_destruction_0(int, int) (ooo/stoc/source/security/file_policy.cxx:70)
   by 0x15E4A5A6: global constructors keyed to _ZN8stoc_sec10FilePolicyC2ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEE (ooo/stoc/source/security/file_policy.cxx:604)
  followed by a later acquisition of lock at 0x5248BA0
   at 0x4C2BC62: pthread_mutex_lock (valgrind-3.6.1/helgrind/hg_intercepts.c:496)
   by 0x4E61A1B: osl_acquireMutex (ooo/sal/osl/unx/mutex.c:129)
   by 0x6FEF9DD: osl::Mutex::acquire() (unxlngx6/inc/osl/mutex.hxx:66)
   by 0x6FEFA0A: osl::Guard<osl::Mutex>::Guard(osl::Mutex*) (unxlngx6/inc/osl/mutex.hxx:145)
   by 0x6FE5C6E: (anonymous namespace)::rtl_Instance<TypeDescriptor_Init_Impl, rtl::Static<TypeDescriptor_Init_Impl, (anonymous namespace)::Init>::StaticInstance, osl::Guard<osl::Mutex>, osl::GetGlobalMutex, int, int>::create(rtl::Static<TypeDescriptor_Init_Impl, (anonymous namespace)::Init>::StaticInstance, osl::GetGlobalMutex) (unxlngx6/inc/rtl/instance.hxx:283)
   by 0x6FE5CC3: rtl::Static<TypeDescriptor_Init_Impl, (anonymous namespace)::Init>::get() (unxlngx6/inc/rtl/instance.hxx:376)
   by 0x6FE72C5: typelib_typedescriptionreference_new (ooo/cppu/source/typelib/typelib.cxx:2290)
   by 0x6FF36F6: typelib_static_type_getByTypeClass (ooo/cppu/source/typelib/static_types.cxx:294)
   by 0x15E3E90C: cppu::detail::getTypeFromTypeClass(_typelib_TypeClass) (unxlngx6/inc/cppu/unotype.hxx:111)
   by 0x15E3E92D: cppu::detail::cppu_detail_getUnoType(rtl::OUString const*) (unxlngx6/inc/cppu/unotype.hxx:194)
   by 0x15E3E93D: cppu::UnoType<rtl::OUString>::get() (unxlngx6/inc/cppu/unotype.hxx:269)
   by 0x15E469CC: com::sun::star::uno::Type const& cppu::getTypeFavourUnsigned<rtl::OUString>(rtl::OUString const*) (unxlngx6/inc/cppu/unotype.hxx:290)
   by 0x15E469F4: com::sun::star::uno::Type const& cppu::getTypeFavourUnsigned<rtl::OUString>(com::sun::star::uno::Sequence<rtl::OUString> const*) (unxlngx6/inc/com/sun/star/uno/Sequence.hxx:228)
   by 0x15E46A36: com::sun::star::uno::Sequence<rtl::OUString>::Sequence(rtl::OUString const*, int) (unxlngx6/inc/com/sun/star/uno/Sequence.hxx:82)
   by 0x15E4A366: __static_initialization_and_destruction_0(int, int) (ooo/stoc/source/security/file_policy.cxx:70)
   by 0x15E4A5A6: global constructors keyed to _ZN8stoc_sec10FilePolicyC2ERKN3com3sun4star3uno9ReferenceINS4_17XComponentContextEEE (ooo/stoc/source/security/file_policy.cxx:604)
Comment 1 Stephan Bergmann 2011-02-28 11:49:11 UTC
fixed as <http://hg.services.openoffice.org/cws/sb140/rev/7f770964f7eb>: cppumaker-generated comprehensive cppu_detail_getUnoType functions used to lock osl::getGlobalMutex(), then call typelib_static_* functionality, which in turn locks typelib_StaticInitMutex::get() and then indirectly locks osl::getGlobalMutex() in rtl::Static constructs; the generated cppu_detail_getUnoType functions have now been changed to use typelib_StaticInitMutex::get() instead
Comment 2 Oliver-Rainer Wittmann 2012-06-13 12:31:24 UTC
getting rid of value "enhancement" for field "severity".
For enhancement the field "issue type" shall be used.