Download it now!
Bug 46678 - deadlock between SolarMutex and CPython global lock
Summary: deadlock between SolarMutex and CPython global lock
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: sdk (show other bugs)
Version:
(earliest affected)
Master old -3.6
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:3.6.0 target:4.4.0 target:4.3.2
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-27 05:19 UTC by Michael Stahl (CIB)
Modified: 2014-08-28 15:54 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 Michael Stahl (CIB) 2012-02-27 05:19:16 UTC
running soffice --valgrind and connecting remotely via pyuno, i get this deadlock.

thread 1 has the SolarMutex and calls listeners, but i think
the SolarMutex probably can't be dropped here.

weird things are going on with JobQueues that i don't understand;
the instances on the stack in thread 1 and 7 look totally unrelated.

what exactly is thread 1 waiting for?


Thread 7 (Thread 16998):
#0  __lll_lock_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:136
#1  0x0000003c26609fb2 in _L_lock_910 () from /lib64/libpthread.so.0
#2  0x0000003c26609e4b in __pthread_mutex_lock (mutex=0x16d6c250) at pthread_mutex_lock.c:86
#3  0x0000000004c2460c in osl_acquireMutex (Mutex=0x16d6c250) at sal/osl/unx/mutex.c:130
#4  0x0000000009035e20 in vcl::SolarMutexObject::acquire (this=0x16d6c1f0) at vcl/source/app/solarmutex.cxx:44
#5  0x00000000094e63fc in SalYieldMutex::acquire (this=0x16d6c1f0) at vcl/generic/app/geninst.cxx:59
#6  0x00000000064c68e2 in SolarMutexGuard::SolarMutexGuard (this=0x1fe7ef10) at solver/unxlngx6/inc/vcl/svapp.hxx:433
#7  0x000000000678c5fd in SfxBaseModel::getSomething (this=0x1976c860, aIdentifier=uno::Sequence of length 16 = {...}) at sfx2/source/doc/sfxbasemodel.cxx:3109
#8  0x0000000022910414 in SwXTextDocument::getSomething (this=0x1976c730, rId=uno::Sequence of length 16 = {...}) at sw/source/ui/uno/unotxdoc.cxx:261
#9  0x00000000157dc7f5 in callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, unsigned int, double*, unsigned int) () from solver/unxlngx6/installation/opt/ure/lib/libgcc3_uno.so
#10 0x00000000157dd335 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) () from solver/unxlngx6/installation/opt/ure/lib/libgcc3_uno.so
#11 0x00000000157dde1a in bridges::cpp_uno::shared::unoInterfaceProxyDispatch(_uno_Interface*, _typelib_TypeDescription const*, void*, void**, _uno_Any**) () from solver/unxlngx6/installation/opt/ure/lib/libgcc3_uno.so
#12 0x000000001b23fdee in binaryurp::IncomingRequest::execute_throw (this=0x1dc0d3d0, returnValue=0x1fe7f980, outArguments=0x1fe7f8f0) at binaryurp/source/incomingrequest.cxx:263
#13 0x000000001b23ed43 in binaryurp::IncomingRequest::execute (this=0x1dc0d3d0) at binaryurp/source/incomingrequest.cxx:89
#14 0x000000001b2599e8 in binaryurp::(anonymous namespace)::request (pThreadSpecificData=0x1dc0d3d0) at binaryurp/source/reader.cxx:107
#15 0x00000000056c0a26 in cppu_threadpool::JobQueue::enter (this=0x1dc00e90, nDisposeId=471903440, bReturnWhenNoJob=1 '\001') at cppu/source/threadpool/jobqueue.cxx:124
#16 0x00000000056c4018 in cppu_threadpool::ORequestThread::run (this=0x1c20acd0) at cppu/source/threadpool/thread.cxx:222
#17 0x00000000056c37b8 in cppu_requestThreadWorker (pVoid=0x1c20acd0) at cppu/source/threadpool/thread.cxx:57
#18 0x0000000004c2f45b in osl_thread_start_Impl (pData=0x1dadc290) at sal/osl/unx/thread.c:303
#19 0x0000003c26607d90 in start_thread (arg=0x1fe80700) at pthread_create.c:309
#20 0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 6 (Thread 16985):
#0  0x0000003c262f031c in __libc_recv (fd=<optimized out>, buf=<optimized out>, n=<optimized out>, flags=<optimized out>) at ../sysdeps/unix/sysv/linux/x86_64/recv.c:34
#1  0x0000000004c25f95 in osl_receivePipe (pPipe=0xe0d6d60, pBuffer=0x1c28ae58, BytesToRead=8) at sal/osl/unx/pipe.c:533
#2  0x0000000004c261d3 in osl_readPipe (pPipe=0xe0d6d60, pBuffer=0x1c28ae58, n=8) at sal/osl/unx/pipe.c:625
#3  0x000000001abba0c0 in osl::StreamPipe::read(void*, int) const () from solver/unxlngx6/installation/opt/ure/lib/acceptor.uno.so
#4  0x000000001abb94e8 in io_acceptor::PipeConnection::read(com::sun::star::uno::Sequence<signed char>&, int) () from solver/unxlngx6/installation/opt/ure/lib/acceptor.uno.so
#5  0x000000001b259807 in binaryurp::(anonymous namespace)::read (connection=..., size=8, eofOk=true) at binaryurp/source/reader.cxx:88
#6  0x000000001b259c35 in binaryurp::Reader::execute (this=0xe1238e0) at binaryurp/source/reader.cxx:126
#7  0x00000000060909d8 in salhelper::Thread::run (this=0xe1238e0) at salhelper/source/thread.cxx:60
#8  0x0000000006091039 in osl::threadFunc (param=0xe1238f0) at solver/unxlngx6/inc/osl/thread.hxx:197
#9  0x0000000004c2f45b in osl_thread_start_Impl (pData=0x16b1a640) at sal/osl/unx/thread.c:303
#10 0x0000003c26607d90 in start_thread (arg=0x1ee7e700) at pthread_create.c:309
#11 0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 5 (Thread 16980):
#0  0x0000003c262f012d in accept () at ../sysdeps/unix/syscall-template.S:82
#1  0x0000000004c25d96 in osl_acceptPipe (pPipe=0xe0d5d10) at sal/osl/unx/pipe.c:467
#2  0x000000001abb9fa4 in osl::Pipe::accept(osl::StreamPipe&) () from solver/unxlngx6/installation/opt/ure/lib/acceptor.uno.so
#3  0x000000001abb9a75 in io_acceptor::PipeAcceptor::accept() () from solver/unxlngx6/installation/opt/ure/lib/acceptor.uno.so
#4  0x000000001abb6225 in io_acceptor::OAcceptor::accept(rtl::OUString const&) () from solver/unxlngx6/installation/opt/ure/lib/acceptor.uno.so
#5  0x000000001a99d2b1 in desktop::Acceptor::run (this=0x19653de0) at desktop/source/offacc/acceptor.cxx:126
#6  0x000000001a99c978 in desktop::workerfunc (acc=0x19653de0) at desktop/source/offacc/acceptor.cxx:44
#7  0x0000000004c2f45b in osl_thread_start_Impl (pData=0x1aec29e0) at sal/osl/unx/thread.c:303
#8  0x0000003c26607d90 in start_thread (arg=0x1bc92700) at pthread_create.c:309
#9  0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 4 (Thread 16975):
#0  0x0000003c262f012d in accept () at ../sysdeps/unix/syscall-template.S:82
#1  0x0000000004c25d96 in osl_acceptPipe (pPipe=0x19411700) at sal/osl/unx/pipe.c:467
#2  0x0000000004f3d114 in osl::Pipe::accept (this=0x19410058, Connection=...) at solver/unxlngx6/inc/osl/pipe.hxx:141
#3  0x0000000004f3af6a in desktop::OfficeIPCThread::execute (this=0x19410030) at desktop/source/app/officeipcthread.cxx:654
#4  0x00000000060909d8 in salhelper::Thread::run (this=0x19410030) at salhelper/source/thread.cxx:60
#5  0x0000000006091039 in osl::threadFunc (param=0x19410040) at solver/unxlngx6/inc/osl/thread.hxx:197
#6  0x0000000004c2f45b in osl_thread_start_Impl (pData=0x19412a20) at sal/osl/unx/thread.c:303
#7  0x0000003c26607d90 in start_thread (arg=0x1a994700) at pthread_create.c:309
#8  0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 3 (Thread 16984):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x0000000004c761b7 in osl_waitCondition (Condition=0xe1231b0, pTimeout=0x0) at sal/osl/unx/conditn.cxx:297
#2  0x000000001b226e6a in osl::Condition::wait (this=0xe123048, pTimeout=0x0) at solver/unxlngx6/inc/osl/conditn.hxx:84
#3  0x000000001b26060c in binaryurp::Writer::execute (this=0xe122e00) at binaryurp/source/writer.cxx:155
#4  0x00000000060909d8 in salhelper::Thread::run (this=0xe122e00) at salhelper/source/thread.cxx:60
#5  0x0000000006091039 in osl::threadFunc (param=0xe122e10) at solver/unxlngx6/inc/osl/thread.hxx:197
#6  0x0000000004c2f45b in osl_thread_start_Impl (pData=0xe123820) at sal/osl/unx/thread.c:303
#7  0x0000003c26607d90 in start_thread (arg=0x1a193700) at pthread_create.c:309
#8  0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 2 (Thread 16973):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x0000000004c448d9 in rtl_cache_wsupdate_wait (seconds=10) at sal/rtl/source/alloc_cache.cxx:1411
#2  0x0000000004c44ab0 in rtl_cache_wsupdate_all (arg=0xa) at sal/rtl/source/alloc_cache.cxx:1551
#3  0x0000003c26607d90 in start_thread (arg=0x14de1700) at pthread_create.c:309
#4  0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 1 (Thread 16972):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x0000000004c761b7 in osl_waitCondition (Condition=0x2807c0b0, pTimeout=0x0) at sal/osl/unx/conditn.cxx:297
#2  0x00000000056c0872 in cppu_threadpool::JobQueue::enter (this=0x2807bca0, nDisposeId=380740848, bReturnWhenNoJob=0 '\000') at cppu/source/threadpool/jobqueue.cxx:90
#3  0x00000000056c83ea in cppu_threadpool::ThreadPool::enter (this=0xe1229c0, aThreadId=..., nDisposeId=380740848) at cppu/source/threadpool/threadpool.cxx:371
#4  0x00000000056c86f2 in uno_threadpool_enter (hPool=0x16b1a4f0, ppJob=0x7feffdcb8) at cppu/source/threadpool/threadpool.cxx:450
#5  0x000000001b22127e in binaryurp::Bridge::makeCall (this=0x16b14d40, oid="a48330;uno[0];4229;83389284dde54ef187a51fb1b14b426", member=..., setter=false, inArguments=std::__debug::vector of length 1, capacity 1 = {...}, returnValue=0x7feffdeb0, outArguments=0x7feffde10) at binaryurp/source/bridge.cxx:579
#6  0x000000001b258e44 in binaryurp::Proxy::do_dispatch_throw (this=0x16bcb890, member=0x16bd20d0, returnValue=0x7feffe470, arguments=0x7feffe1b0, exception=0x7feffe238) at binaryurp/source/proxy.cxx:192
#7  0x000000001b2587cf in binaryurp::Proxy::do_dispatch (this=0x16bcb890, member=0x16bd20d0, returnValue=0x7feffe470, arguments=0x7feffe1b0, exception=0x7feffe238) at binaryurp/source/proxy.cxx:118
#8  0x000000001b258555 in binaryurp::(anonymous namespace)::proxy_dispatchInterface (pUnoI=0x16bcb890, pMemberType=0x16bd20d0, pReturn=0x7feffe470, pArgs=0x7feffe1b0, ppException=0x7feffe238) at binaryurp/source/proxy.cxx:71
#9  0x00000000157db68d in cpp2uno_call(bridges::cpp_uno::shared::CppInterfaceProxy*, _typelib_TypeDescription const*, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void**, void**, void**, unsigned long*) () from solver/unxlngx6/installation/opt/ure/lib/libgcc3_uno.so
#10 0x00000000157dbffb in cpp_vtable_call () from solver/unxlngx6/installation/opt/ure/lib/libgcc3_uno.so
#11 0x00000000157de10a in privateSnippetExecutor () from solver/unxlngx6/installation/opt/ure/lib/libgcc3_uno.so
#12 0x00000000067b0dfc in cppu::OInterfaceContainerHelper::NotifySingleListener<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator() (this=0x7feffe5b0, listener=...) at solver/unxlngx6/inc/cppuhelper/interfacecontainer.h:272
#13 0x00000000067afec3 in cppu::OInterfaceContainerHelper::forEach<com::sun::star::document::XDocumentEventListener, cppu::OInterfaceContainerHelper::NotifySingleListener<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> > (this=0x1dbf9a48, func=...) at solver/unxlngx6/inc/cppuhelper/interfacecontainer.h:289
#14 0x00000000067af15a in cppu::OInterfaceContainerHelper::notifyEach<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> (this=0x1dbf9a48, NotificationMethod=&virtual table offset 32, Event=...) at solver/unxlngx6/inc/cppuhelper/interfacecontainer.h:303
#15 0x00000000067ad8d2 in SfxGlobalEvents_Impl::implts_notifyListener (this=0x1dbf99b0, aEvent=...) at sfx2/source/notify/eventsupplier.cxx:848
#16 0x00000000067ac733 in SfxGlobalEvents_Impl::documentEventOccured (this=0x1dbf99b0, _Event=...) at sfx2/source/notify/eventsupplier.cxx:654
#17 0x0000000006793f60 in (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent>::operator() (this=0x7feffe7d0, listener=...) at sfx2/source/doc/sfxbasemodel.cxx:2937
#18 0x0000000006793cd9 in cppu::OInterfaceContainerHelper::forEach<com::sun::star::document::XDocumentEventListener, {anonymous}::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> >(const (anonymous namespace)::NotifySingleListenerIgnoreRE<com::sun::star::document::XDocumentEventListener, com::sun::star::document::DocumentEvent> &) (this=0x1792c640, func=...) at solver/unxlngx6/inc/cppuhelper/interfacecontainer.h:289
#19 0x000000000678bb1c in SfxBaseModel::postEvent_Impl (this=0x1976c860, aName="OnPageCountChange", xController=...) at sfx2/source/doc/sfxbasemodel.cxx:2973
#20 0x00000000067894b8 in SfxBaseModel::Notify (this=0x1976c860, rBC=..., rHint=...) at sfx2/source/doc/sfxbasemodel.cxx:2601
#21 0x0000000006d6259b in SfxBroadcaster::Broadcast (this=0x18e04030, rHint=...) at svl/source/notify/brdcst.cxx:64
#22 0x00000000064ba635 in SfxEventAsyncer_Impl::TimerHdl (this=0x1d2b51f0, pAsyncTimer=0x1d2b7830) at sfx2/source/appl/appcfg.cxx:155
#23 0x00000000064ba4db in SfxEventAsyncer_Impl::LinkStubTimerHdl (pThis=0x1d2b51f0, pCaller=0x1d2b7830) at sfx2/source/appl/appcfg.cxx:140
#24 0x0000000009023272 in Link::Call (this=0x1d2b7850, pCaller=0x1d2b7830) at solver/unxlngx6/inc/tools/link.hxx:140
#25 0x00000000090456fd in Timer::Timeout (this=0x1d2b7830) at vcl/source/app/timer.cxx:255
#26 0x0000000009045366 in Timer::ImplTimerCallbackProc () at vcl/source/app/timer.cxx:143
#27 0x0000000016fd2877 in SalTimer::CallCallback (this=0x1dc9f7f0) at vcl/inc/saltimer.hxx:66
#28 0x0000000016fd1c98 in SvpSalInstance::CheckTimeout (this=0x16d6c2c0, bExecuteTimers=true) at vcl/headless/svpinst.cxx:176
#29 0x0000000016fd22c0 in SvpSalInstance::Yield (this=0x16d6c2c0, bWait=true, bHandleAllCurrentEvents=false) at vcl/headless/svpinst.cxx:287
#30 0x000000000903a947 in ImplYield (i_bWait=true, i_bAllEvents=false) at vcl/source/app/svapp.cxx:451
#31 0x0000000009036f39 in Application::Yield (i_bAllEvents=false) at vcl/source/app/svapp.cxx:485
#32 0x0000000009036eda in Application::Execute () at vcl/source/app/svapp.cxx:430
#33 0x0000000004f049bd in desktop::Desktop::Main (this=0x7fefff400) at desktop/source/app/app.cxx:1811
#34 0x0000000009043052 in ImplSVMain () at vcl/source/app/svmain.cxx:178
#35 0x0000000009043198 in SVMain () at vcl/source/app/svmain.cxx:215
#36 0x0000000004f3f3f6 in soffice_main () at desktop/source/app/sofficemain.cxx:75
#37 0x0000000000400734 in sal_main () at desktop/source/app/main.c:34
#38 0x0000000000400719 in main (argc=10, argv=0x7fefff5b8) at desktop/source/app/main.c:33
Comment 1 Stephan Bergmann 2012-02-27 05:34:08 UTC
Thread 1, in NotifySingleListenerIgnoreRE in frame #17, is making a remote call, so thread 1 is blocked waiting for the response of that remote call coming back in.

At the same time, thread 7 is processing a call to SwXTextDocument::getSomething that came in from remote, but apparently on a different logical UNO thread than the logical UNO thread on which thread 1.

So the two are indeed unrelated.  The question is why the remote side of thread 1 (processing the listener call) cannot make progress while thread 7 is blocked waiting for the solar mutex.

However, it is always an error to call listeners with a mutex locked.
Comment 2 Michael Stahl (CIB) 2012-02-27 05:50:39 UTC
stacks from the python pyuno process:

Thread 5 (Thread 0x7faf70a4e700 (LWP 16949)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:216
#1  0x00007faf70ca48d9 in rtl_cache_wsupdate_wait (seconds=10) at sal/rtl/source/alloc_cache.cxx:1411
#2  0x00007faf70ca4ab0 in rtl_cache_wsupdate_all (arg=0xa) at sal/rtl/source/alloc_cache.cxx:1551
#3  0x0000003c26607d90 in start_thread (arg=0x7faf70a4e700) at pthread_create.c:309
#4  0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 4 (Thread 0x7faf6d39d700 (LWP 16982)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x00007faf70cd61b7 in osl_waitCondition (Condition=0xa307c0, pTimeout=0x0) at sal/osl/unx/conditn.cxx:297
#2  0x00007faf6d3f9e6a in osl::Condition::wait (this=0xa306c8, pTimeout=0x0) at solver/unxlngx6/inc/osl/conditn.hxx:84
#3  0x00007faf6d43360c in binaryurp::Writer::execute (this=0xa30480) at binaryurp/source/writer.cxx:155
#4  0x00007faf70a649d8 in salhelper::Thread::run (this=0xa30480) at salhelper/source/thread.cxx:60
#5  0x00007faf70a65039 in osl::threadFunc (param=0xa30490) at solver/unxlngx6/inc/osl/thread.hxx:197
#6  0x00007faf70c8f45b in osl_thread_start_Impl (pData=0xa30a00) at sal/osl/unx/thread.c:303
#7  0x0000003c26607d90 in start_thread (arg=0x7faf6d39d700) at pthread_create.c:309
#8  0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 3 (Thread 0x7faf6cb9c700 (LWP 16983)):
#0  0x0000003c2660e99c in __libc_recv (fd=<optimized out>, buf=<optimized out>, n=<optimized out>, flags=<optimized out>) at ../sysdeps/unix/sysv/linux/x86_64/recv.c:34
#1  0x00007faf70c85f95 in osl_receivePipe (pPipe=0xa2df90, pBuffer=0x7faf70a5cc28, BytesToRead=8) at sal/osl/unx/pipe.c:533
#2  0x00007faf70c861d3 in osl_readPipe (pPipe=0xa2df90, pBuffer=0x7faf70a5cc28, n=8) at sal/osl/unx/pipe.c:625
#3  0x00007faf6d66f9b8 in osl::StreamPipe::read(void*, int) const () from solver/unxlngx6/installation/opt/ure/lib/connector.uno.so
#4  0x00007faf6d66f4e5 in stoc_connector::PipeConnection::read(com::sun::star::uno::Sequence<signed char>&, int) () from solver/unxlngx6/installation/opt/ure/lib/connector.uno.so
#5  0x00007faf6d42c807 in binaryurp::(anonymous namespace)::read (connection=..., size=8, eofOk=true) at binaryurp/source/reader.cxx:88
#6  0x00007faf6d42cc35 in binaryurp::Reader::execute (this=0xa30be0) at binaryurp/source/reader.cxx:126
#7  0x00007faf70a649d8 in salhelper::Thread::run (this=0xa30be0) at salhelper/source/thread.cxx:60
#8  0x00007faf70a65039 in osl::threadFunc (param=0xa30bf0) at solver/unxlngx6/inc/osl/thread.hxx:197
#9  0x00007faf70c8f45b in osl_thread_start_Impl (pData=0xa32430) at sal/osl/unx/thread.c:303
#10 0x0000003c26607d90 in start_thread (arg=0x7faf6cb9c700) at pthread_create.c:309
#11 0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 2 (Thread 0x7faf67fff700 (LWP 16999)):
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x00007faf79bd3094 in PyThread_acquire_lock () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#2  0x00007faf79b94a36 in PyEval_AcquireThread () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#3  0x00007faf714c773d in pyuno::PyThreadAttach::PyThreadAttach(_is*) () from solver/unxlngx6/installation/opt/program/libpyuno.so
#4  0x00007faf714ea017 in pyuno::Adapter::invoke(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Sequence<short>&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) () from solver/unxlngx6/installation/opt/program/libpyuno.so
#5  0x00007faf6f60f7f5 in ?? () from solver/unxlngx6/lib/libgcc3_uno.so
#6  0x00007faf6f610335 in ?? () from solver/unxlngx6/lib/libgcc3_uno.so
#7  0x00007faf6f610e1a in ?? () from solver/unxlngx6/lib/libgcc3_uno.so
#8  0x00007faf6dabda0d in stoc_invadp::AdapterImpl::invoke(_typelib_TypeDescription const*, void*, void**, _uno_Any**) () from solver/unxlngx6/installation/opt/ure/lib/invocadapt.uno.so
#9  0x00007faf6dabe01d in adapter_dispatch () from solver/unxlngx6/installation/opt/ure/lib/invocadapt.uno.so
#10 0x00007faf6d412dee in binaryurp::IncomingRequest::execute_throw (this=0x7faf6000a5a0, returnValue=0x7faf67ffeb40, outArguments=0x7faf67ffeab0) at binaryurp/source/incomingrequest.cxx:263
#11 0x00007faf6d411d43 in binaryurp::IncomingRequest::execute (this=0x7faf6000a5a0) at binaryurp/source/incomingrequest.cxx:89
#12 0x00007faf6d42c9e8 in binaryurp::(anonymous namespace)::request (pThreadSpecificData=0x7faf6000a5a0) at binaryurp/source/reader.cxx:107
#13 0x00007faf71222a26 in cppu_threadpool::JobQueue::enter (this=0x7faf6000a630, nDisposeId=140391206659312, bReturnWhenNoJob=1 '\001') at cppu/source/threadpool/jobqueue.cxx:124
#14 0x00007faf71226018 in cppu_threadpool::ORequestThread::run (this=0x7faf6000a4f0) at cppu/source/threadpool/thread.cxx:222
#15 0x00007faf712257b8 in cppu_requestThreadWorker (pVoid=0x7faf6000a4f0) at cppu/source/threadpool/thread.cxx:57
#16 0x00007faf70c8f45b in osl_thread_start_Impl (pData=0x7faf6000a710) at sal/osl/unx/thread.c:303
#17 0x0000003c26607d90 in start_thread (arg=0x7faf67fff700) at pthread_create.c:309
#18 0x0000003c262ef48d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 1 (Thread 0x7faf79a67700 (LWP 16937)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:165
#1  0x00007faf70cd61b7 in osl_waitCondition (Condition=0xa39730, pTimeout=0x0) at sal/osl/unx/conditn.cxx:297
#2  0x00007faf71222872 in cppu_threadpool::JobQueue::enter (this=0xa4a450, nDisposeId=10683168, bReturnWhenNoJob=0 '\000') at cppu/source/threadpool/jobqueue.cxx:90
#3  0x00007faf7122a3ea in cppu_threadpool::ThreadPool::enter (this=0xa30340, aThreadId=..., nDisposeId=10683168) at cppu/source/threadpool/threadpool.cxx:371
#4  0x00007faf7122a6f2 in uno_threadpool_enter (hPool=0xa30320, ppJob=0x7fffcdad7568) at cppu/source/threadpool/threadpool.cxx:450
#5  0x00007faf6d3f427e in binaryurp::Bridge::makeCall (this=0x7faf6dcdb718, oid="1976c730;gcc3[0];dfe86ea49a342658dcc7afb610f5dc", member=..., setter=false, inArguments=std::__debug::vector of length 1, capacity 1 = {...}, returnValue=0x7fffcdad7760, outArguments=0x7fffcdad76c0) at binaryurp/source/bridge.cxx:579
#6  0x00007faf6d42be44 in binaryurp::Proxy::do_dispatch_throw (this=0x7faf60009460, member=0xa198c0, returnValue=0x7fffcdad7ce0, arguments=0x7fffcdad7a20, exception=0x7fffcdad7aa8) at binaryurp/source/proxy.cxx:192
#7  0x00007faf6d42b7cf in binaryurp::Proxy::do_dispatch (this=0x7faf60009460, member=0xa198c0, returnValue=0x7fffcdad7ce0, arguments=0x7fffcdad7a20, exception=0x7fffcdad7aa8) at binaryurp/source/proxy.cxx:118
#8  0x00007faf6d42b555 in binaryurp::(anonymous namespace)::proxy_dispatchInterface (pUnoI=0x7faf60009460, pMemberType=0xa198c0, pReturn=0x7fffcdad7ce0, pArgs=0x7fffcdad7a20, ppException=0x7fffcdad7aa8) at binaryurp/source/proxy.cxx:71
#9  0x00007faf6f60e68d in ?? () from solver/unxlngx6/lib/libgcc3_uno.so
#10 0x00007faf6f60effb in ?? () from solver/unxlngx6/lib/libgcc3_uno.so
#11 0x00007faf6f61110a in ?? () from solver/unxlngx6/lib/libgcc3_uno.so
#12 0x00007faf714c4a8d in pyuno::Runtime::any2PyObject(com::sun::star::uno::Any const&) const () from solver/unxlngx6/installation/opt/program/libpyuno.so
#13 0x00007faf714da14f in pyuno::PyUNO_callable_call(_object*, _object*, _object*) () from solver/unxlngx6/installation/opt/program/libpyuno.so
#14 0x00007faf79adadff in PyObject_Call () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#15 0x00007faf79b9cc5d in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#16 0x00007faf79b9c4e0 in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#17 0x00007faf79b98bf7 in PyEval_EvalFrameEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#18 0x00007faf79b9c6ca in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#19 0x00007faf79b9c4c4 in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#20 0x00007faf79b98bf7 in PyEval_EvalFrameEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#21 0x00007faf79b9c6ca in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#22 0x00007faf79b9c4c4 in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#23 0x00007faf79b98bf7 in PyEval_EvalFrameEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#24 0x00007faf79b9c6ca in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#25 0x00007faf79b9c4c4 in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#26 0x00007faf79b98bf7 in PyEval_EvalFrameEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#27 0x00007faf79b9c6ca in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#28 0x00007faf79b9c4c4 in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#29 0x00007faf79b98bf7 in PyEval_EvalFrameEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#30 0x00007faf79b9a689 in PyEval_EvalCodeEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#31 0x00007faf79b9c7bc in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#32 0x00007faf79b9c4c4 in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#33 0x00007faf79b98bf7 in PyEval_EvalFrameEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#34 0x00007faf79b9a689 in PyEval_EvalCodeEx () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#35 0x00007faf79b94f4a in PyEval_EvalCode () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#36 0x00007faf79bc5557 in ?? () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#37 0x00007faf79bc54e0 in PyRun_FileExFlags () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#38 0x00007faf79bc4237 in PyRun_SimpleFileExFlags () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#39 0x00007faf79bc3a56 in PyRun_AnyFileExFlags () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#40 0x00007faf79bd5a1b in Py_Main () from solver/unxlngx6/installation/opt/program/libpython2.6.so
#41 0x0000000000400724 in main ()
Comment 3 Michael Stahl (CIB) 2012-02-27 05:51:42 UTC
at first i was confused by the JobQueues on the soffice.bin stacks,
until i realized that they are actually unrelated.

soffice.bin thread 1 holds SolarMutex and calls a listener across the bridge into pyuno process thread 2, trying to acquire CPython global lock;
pyuno process thread 1 holds the CPython global lock and calls across the bridge into soffice.bin thread 7, trying to acquire SolarMutex.

yay for distributed deadlocks!
Comment 4 Michael Stahl (CIB) 2012-02-27 05:53:49 UTC
> However, it is always an error to call listeners with a mutex locked.

that is certainly true, but with the recursive nature of SolarMutex
it is probably not safe to release it across listener calls i'm afraid.
Comment 5 Stephan Bergmann 2012-02-27 06:19:34 UTC
(In reply to comment #4)
> > However, it is always an error to call listeners with a mutex locked.
> 
> that is certainly true, but with the recursive nature of SolarMutex
> it is probably not safe to release it across listener calls i'm afraid.

Sure, that's why SolarMutex is evil.
Comment 6 Not Assigned 2012-02-27 12:05:22 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3f43ebb4c3daf3e5c20a30a84f97bb4c93bff8a6

fdo#46678: tweak SfxBaseModel::getSomething:
Comment 7 Michael Meeks 2013-06-11 15:20:15 UTC
should we mark this one 'fixed' too ? :-)
Comment 8 Michael Stahl (CIB) 2013-07-10 22:04:02 UTC
not sure about fixed but will settle for WFM
Comment 9 Michael Stahl (CIB) 2014-08-28 14:22:50 UTC
while thinking about CPython's GIL i came to the conclusion it shouldn't cause deadlocks for us, then remembered this bug... now have a real fix for it, just drop the GIL before calling UNO methods like is already done in other functions in pyuno.
Comment 10 Commit Notification 2014-08-28 14:24:00 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0364d3b7e670bddb49d5132268cf28737c3301c6

fdo#46678: pyuno: fix deadlock in Runtime::any2PyObject()



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2014-08-28 15:54:40 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f919c2c441a88837f3a85b90011ea3d91041f4bb&h=libreoffice-4-3

fdo#46678: pyuno: fix deadlock in Runtime::any2PyObject()


It will be available in LibreOffice 4.3.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.