[Libreoffice-bugs] [Bug 113311] New: lifecycle of LibreOfficeKit as used by LOKDocView is broken by design

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Oct 20 20:13:33 UTC 2017


https://bugs.documentfoundation.org/show_bug.cgi?id=113311

            Bug ID: 113311
           Summary: lifecycle of LibreOfficeKit as used by LOKDocView is
                    broken by design
           Product: LibreOffice
           Version: 6.0.0.0.alpha0+ Master
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: LibreOffice
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: mstahl at redhat.com
                CC: caolanm at redhat.com, kendy at collabora.com,
                    pranavk at collabora.co.uk, sbergman at redhat.com

this deadlock just happened in CppunitTest_libreofficekit_tiledrendering:

#0  0x00007fa3811fb09d in __lll_lock_wait () at /lib64/libpthread.so.0
#1  0x00007fa3811f3e23 in pthread_mutex_lock () at /lib64/libpthread.so.0
#2  0x00007fa3822f5a16 in osl_acquireMutex(oslMutexImpl*) (pMutex=0x2d32f40) at
/work/lo/master/sal/osl/unx/mutex.cxx:97
#3  0x00007fa37764b065 in osl::Mutex::acquire() (this=0x7fa36948f780
<rtl::Static<osl::Mutex, GrammarCheckingIterator::MyMutex>::get()::instance>)
at /work/lo/master/include/osl/mutex.hxx:56
#4  0x00007fa3776629c2 in
osl::ClearableGuard<osl::Mutex>::ClearableGuard(osl::Mutex&)
(this=0x7fffcfc0df18, t=...) at /work/lo/master/include/osl/mutex.hxx:163
#5  0x00007fa3776610c5 in
comphelper::OInterfaceContainerHelper2::disposeAndClear(com::sun::star::lang::EventObject
const&) (this=0x7fa357bb3110, rEvt=...) at
/work/lo/master/comphelper/source/container/interfacecontainer2.cxx:260
#6  0x00007fa369197174 in GrammarCheckingIterator::dispose()
(this=0x7fa357bb2f50) at /work/lo/master/linguistic/source/gciterator.cxx:907
#7  0x00007fa351bd7191 in (anonymous
namespace)::doDispose(com::sun::star::uno::Reference<com::sun::star::linguistic2::XProofreadingIterator>
const&) (inst=uno::Reference to (GrammarCheckingIterator *) 0x7fa357bb2f78) at
/work/lo/master/sw/source/core/bastyp/proofreadingiterator.cxx:34
#8  0x00007fa351bd7327 in sw::proofreadingiterator::dispose() () at
/work/lo/master/sw/source/core/bastyp/proofreadingiterator.cxx:66
#9  0x00007fa351bd1d3e in FinitCore() () at
/work/lo/master/sw/source/core/bastyp/init.cxx:672
#10 0x00007fa35284e394 in SwDLL::~SwDLL() (this=0x2b9b7e0, __in_chrg=<optimized
out>) at /work/lo/master/sw/source/uibase/app/swdll.cxx:163
#11 0x00007fa35284f634 in std::default_delete<SwDLL>::operator()(SwDLL*) const
(this=0x7fa353adea98 <rtl::Static<(anonymous namespace)::SwDLLInstance,
(anonymous namespace)::theSwDLLInstance>::get()::instance+8>, __ptr=0x2b9b7e0)
at /usr/include/c++/7/bits/unique_ptr.h:78
#12 0x00007fa35284f8e9 in std::unique_ptr<SwDLL, std::default_delete<SwDLL>
>::reset(SwDLL*) (this=0x7fa353adea98 <rtl::Static<(anonymous
namespace)::SwDLLInstance, (anonymous
namespace)::theSwDLLInstance>::get()::instance+8>, __p=0x2b9b7e0) at
/usr/include/c++/7/bits/unique_ptr.h:376
#13 0x00007fa35284f3a1 in
comphelper::unique_disposing_ptr<SwDLL>::reset(SwDLL*) (this=0x7fa353adea90
<rtl::Static<(anonymous namespace)::SwDLLInstance, (anonymous
namespace)::theSwDLLInstance>::get()::instance>, p=0x0) at
/work/lo/master/include/comphelper/unique_disposing_ptr.hxx:42
#14 0x00007fa35284ec7e in
comphelper::unique_disposing_solar_mutex_reset_ptr<SwDLL>::reset(SwDLL*)
(this=0x7fa353adea90 <rtl::Static<(anonymous namespace)::SwDLLInstance,
(anonymous namespace)::theSwDLLInstance>::get()::instance>, p=0x0) at
/work/lo/master/include/comphelper/unique_disposing_ptr.hxx:171
#15 0x00007fa35284e5fa in
comphelper::unique_disposing_solar_mutex_reset_ptr<SwDLL>::~unique_disposing_solar_mutex_reset_ptr()
(this=0x7fa353adea90 <rtl::Static<(anonymous namespace)::SwDLLInstance,
(anonymous namespace)::theSwDLLInstance>::get()::instance>,
__in_chrg=<optimized out>) at
/work/lo/master/include/comphelper/unique_disposing_ptr.hxx:177
#16 0x00007fa35284e460 in (anonymous
namespace)::SwDLLInstance::~SwDLLInstance() (this=0x7fa353adea90
<rtl::Static<(anonymous namespace)::SwDLLInstance, (anonymous
namespace)::theSwDLLInstance>::get()::instance>, __in_chrg=<optimized out>) at
/work/lo/master/sw/source/uibase/app/swdll.cxx:57
#17 0x00007fa381647c68 in __run_exit_handlers () at /lib64/libc.so.6
#18 0x00007fa381647cba in  () at /lib64/libc.so.6
#19 0x00007fa38162d511 in __libc_start_main () at /lib64/libc.so.6
#20 0x000000000040a1ba in _start ()

actually it's not really a deadlock - the mutex being locked
is a global variable that has already been destroyed - usually
this only prints a warning like
"pthread_mutex_lock failed: Invalid argument"
but apparently sometimes the freed memory looks like a valid
mutex that is already locked.

this is a regression from:

commit a99707d2c4f65a6a5fe160ce2b614aca273f0d2d
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon May 8 15:26:22 2017 +0100

    Resolves: rhbz#144437 make gnome-documents not crash the whole time

    accept that once initted that LibreOffice cannot be deinitted and reinited
    (without lots of work), but allow the main loop to quit and restart so LOKs
    thread can run and exit successfully, new LOK connections will restart the
m
ain
    loop.

    The buckets of global state continues to be valid the whole time this way


... which turned framework::Desktop::terminate() into a no-op when
called from LOKit.

this is clearly the wrong solution to the problem - now there is no
way for a LibreOfficeKit client to actually destroy all the thousands
of global variables, so unless the client uses _exit(), they
will sometimes crash or deadlock during shutdown.

(i would not be opposed to requiring LOKit clients to use _exit(),
but that should be documented somewhere.)

really the problem is that in the LOKDocView the
"static void lok_doc_view_destroy (GtkWidget* widget)"
calls "priv->m_pOffice->pClass->destroy (priv->m_pOffice)"
- but this must be called only once per process, when
the process shuts down, not when just some view is destroyed.

because of this i'll disable the unit test on master now.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20171020/333bf60c/attachment-0001.html>


More information about the Libreoffice-bugs mailing list