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

            Bug ID: 152261
           Summary: Inserting a TOC in a document using UNO locks writer
           Product: LibreOffice
           Version: 7.4.3.2 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 183848
  --> https://bugs.documentfoundation.org/attachment.cgi?id=183848&action=edit
Test case to reproduce the issue.

I have a program which using the java UNO api using Jodconverter with a Filter
which does inserts in ODT documents.

Combining the actions "insert another document and load styles from another
document" with a insert TOC or update TOC action locks libreoffice on some
documents (not all). The cpu of soffice.bin goes 100% and the jodconverter task
timesouts. Debugging in java shows jodconverter waiting. 

The issue reproduces on libreoffice 7.2, 7.3, 7.4.3.2 (ubuntu) and 7.5 alpha
from Nov 27*. It also reproduces on Debian 11 with similar versions including
7.5 alpha.

While multiple factors need to be there, the problem seems to be close to the
TOC. Removing the TOC insert or update makes the code work. Using a smaller
files also makes the code work. 

I have a test case to show when the code is working and when the code is
failing and multiple gdb stack traces. Which are attached. See below for
indication on how to run the test case.

Here is a sample gdb stack trace on 7.5 alpha (some stack traces are slightly
different then this one where tweaking the test case).

libreoffice7.5 (Nov 28) runfailing3 
#0  0x00007fd00d0d71c6 in void std::__cxx1998::vector<hb_feature_t,
std::allocator<hb_feature_t>
>::_M_realloc_insert<hb_feature_t>(__gnu_cxx::__normal_iterator<hb_feature_t*,
std::__cxx1998::vector<hb_feature_t, std::allocator<hb_feature_t> > >,
hb_feature_t&&) ()
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/vector.tcc:403
warning: Could not find DWO CU
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/build_master/workdir/CxxObject/sw/source/core/text/inftxt.dwo(0x59e643fd3f397c6f)
referenced by CU at offset 0x3ab4 [in module
/opt/libreoffice7.5/program/../program/libswlo.so]
#1  0x00007fd00d0d5ea4 in hb_feature_t& std::__cxx1998::vector<hb_feature_t,
std::allocator<hb_feature_t> >::emplace_back<hb_feature_t>(hb_feature_t&&) ()
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/bits/vector.tcc:105
warning: Could not find DWO CU
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/build_master/workdir/CxxObject/sw/source/core/text/guess.dwo(0x734c75171111c19c)
referenced by CU at offset 0x3a80 [in module
/opt/libreoffice7.5/program/../program/libswlo.so]
#2  0x00007fd00d0d496c in hb_feature_t& std::__debug::vector<hb_feature_t,
std::allocator<hb_feature_t> >::emplace_back<hb_feature_t>(hb_feature_t&&) ()
    at /opt/rh/devtoolset-7/root/usr/include/c++/7/debug/vector:489
#3  0x00007fd00d0d3468 in __gnu_cxx::__enable_if<!std::__are_same<hb_feature_t,
bool>::__value, void>::__type std::__debug::vector<hb_feature_t,
std::allocator<hb_feature_t> >::push_back<hb_feature_t>(hb_feature_t&&) () at
/opt/rh/devtoolset-7/root/usr/include/c++/7/debug/vector:478
#4  0x00007fd00d0cbc8f in
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs&, SalLayoutGlyphsImpl
const*) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/vcl/source/gdi/CommonSalLayout.cxx:299
#5  0x00007fd00cdb5e8b in OutputDevice::ImplLayout(rtl::OUString const&, int,
int, Point const&, long, o3tl::span<int const>, o3tl::span<unsigned char
const>, SalLayoutFlags, vcl::text::TextLayoutCache const*, SalLayoutGlyphs
const*) const ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/vcl/source/outdev/text.cxx:1410
#6  0x00007fd00cf25a12 in
SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<OutputDevice const>, rtl::OUString
const&, int, int, long, vcl::text::TextLayoutCache const*) () at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/vcl/source/gdi/impglyphitem.cxx:422
#7  0x00007fcff126cc94 in GetTextArray(OutputDevice const&, rtl::OUString
const&, std::__debug::vector<int, std::allocator<int> >&, int, int, bool,
vcl::text::TextLayoutCache const*) () at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/txtnode/fntcache.cxx:739
#8  0x00007fcff126ceb2 in GetTextArray(OutputDevice const&, SwDrawTextInfo
const&, std::__debug::vector<int, std::allocator<int> >&, int, bool) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/txtnode/fntcache.cxx:755
#9  0x00007fcff1271bd1 in SwFntObj::GetTextSize(SwDrawTextInfo&) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/txtnode/fntcache.cxx:1614
#10 0x00007fcff12cf6f4 in SwSubFont::GetTextSize_(SwDrawTextInfo&) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/txtnode/swfont.cxx:1006
#11 0x00007fcff1102d4f in SwFont::GetTextSize_(SwDrawTextInfo&) () at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/inc/swfont.hxx:311
#12 0x00007fcff111da3a in SwTextSizeInfo::GetTextSize(SwScriptInfo const*,
o3tl::strong_int<int, Tag_TextFrameIndex>, o3tl::strong_int<int,
Tag_TextFrameIndex>, unsigned short, unsigned short&, unsigned short&,
vcl::text::TextLayoutCache const*) const ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/text/inftxt.cxx:432
#13 0x00007fcff1119135 in SwTextGuess::Guess(SwTextPortion const&,
SwTextFormatInfo&, unsigned short) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/text/guess.cxx:609
#14 0x00007fcff11b0479 in SwTextPortion::Format_(SwTextFormatInfo&) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/text/portxt.cxx:305
#15 0x00007fcff11b122c in SwTextPortion::Format(SwTextFormatInfo&) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/text/portxt.cxx:462
#16 0x00007fcff116afb4 in SwLineLayout::Format(SwTextFormatInfo&) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/text/porlay.cxx:296
#17 0x00007fcff11421bf in SwTextFormatter::BuildPortions(SwTextFormatInfo&) ()
    at
/home/tdf/lode/jenkins/workspace/lo_gerrit/tb/src_master/sw/source/core/text/itrform2.cxx:597
#18 0x00007fcff1148dce in SwTextFormatter::FormatLine(o3tl::strong_int<int,
Tag_TextFrameIndex>) ()



To run the test cases:

1/ Download the officepb.zip
2/ Download jodconverter cli 4.4 zip or tar:
https://github.com/sbraconnier/jodconverter/releases/tag/v4.4.4 unzip it inside
officepb.zip
3/ If you have jdk11 and libreoffice installed, you should be able to run
./runworking.sh or runfailing1.sh to reproduce the issue. Some debug should
show where the code is. If there is no lock the program should end in less than
10 seconds. If not it will wait for the jodconverter timeout.

If somebeody tries the test case and has a difficulty, I can help make it work.

The issue looks similar to:
https://bugs.documentfoundation.org/show_bug.cgi?id=152166
https://bugs.documentfoundation.org/show_bug.cgi?id=150138
https://bugs.documentfoundation.org/show_bug.cgi?id=151736
but I was not able to reproduce this in the writer manually.



Some additional stack traces pastebin:
lo74 https://pastebin.com/T19WtyTE
lo74 https://pastebin.com/6aQ52H2S
lo75 https://pastebin.com/f7niY9h0
lo75 https://pastebin.com/nRFHH8T8
lo75 https://pastebin.com/Sv4ur1kR

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to