Bug 135942 - crashtesting failure on export to docx
Summary: crashtesting failure on export to docx
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
7.1.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0 target:7.0.2 target:6.4.7
Keywords: haveBacktrace
: 137103 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-08-20 09:19 UTC by Caolán McNamara
Modified: 2020-10-06 12:54 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
gdb bt (22.49 KB, text/plain)
2020-08-20 12:56 UTC, Julien Nabet
Details
Valgrind trace (180.57 KB, text/x-log)
2020-08-20 13:33 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Caolán McNamara 2020-08-20 09:19:18 UTC
Description:
https://dev-builds.libreoffice.org/crashtest/5923d4173d5000d3462fa6e55952bfc5101b6bfa/backtraces/task800-core.backtrace.txt

Steps to Reproduce:
1. wget https://bugs.documentfoundation.org/attachment.cgi?id=99333 -O tdf78907-1.docx
2. ./instdir/program/soffice.bin --headless --convert-to odt ./tdf78907-1.docx

Actual Results:
crash

Expected Results:
no crash


Reproducible: Always


User Profile Reset: No



Additional Info:
commit 35021cd56b3b4e38035804087f215c80085564be
Date:   Wed Aug 5 11:16:32 2020 +0300

    tdf#124470: Split export of table autostyles out from collection phase
    
    This allows to call collectAutoStyles where required (e.g. when enumerating
    used fonts), without side effect of writing table styles XML inside the call,
    out of place.
Comment 1 Caolán McNamara 2020-08-20 09:30:34 UTC
seems to have begin with 35021cd56b3b4e38035804087f215c80085564be from
tdf#124470: Split export of table autostyles out from collection phase
Comment 2 Mike Kaganski 2020-08-20 09:52:11 UTC
I can't repro here on Win10 with dbgutil build ... :-(
Comment 3 Julien Nabet 2020-08-20 12:56:52 UTC
Created attachment 164494 [details]
gdb bt

Here's a bt retrieved on pc Debian x86-64 with master sources updated today
commit ec579354af954867b829e7d08e4d752518c83728 (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Stahl <Michael.Stahl@cib.de>
Date:   Wed Aug 19 18:55:27 2020 +0200

    tdf#135721 sw: fix spell check context menu deleting flys
Comment 4 Caolán McNamara 2020-08-20 13:24:29 UTC
#0  SwXMLTextParagraphExport::exportTable(com::sun::star::uno::Reference<com::sun::star::text::XTextContent> const&, bool, bool)
    (this=0x1a76150, rTextContent=uno::Reference to (SwXTextTable *) 0x5143a28, bAutoStyles=true, _bProgress=true) at sw/source/filter/xml/xmltble.cxx:1203
#1  0x00007fffec068c39 in XMLTextParagraphExport::exportTextContentEnumeration(com::sun::star::uno::Reference<com::sun::star::container::XEnumeration> const&, bool, com::sun::star::uno::Reference<com::sun::star::text::XTextSection> const&, bool, bool, com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const*, TextPNS)
    (this=0x1a76150, rContEnum=uno::Reference to ((anonymous namespace)::SwXParagraphEnumerationImpl *) 0x50ddb60, bAutoStyles=true, rBaseSection=empty uno::Reference, bIsProgress=true, bExportParagraph=true, pRangePropSet=0x0, eExtensionNS=TextPNS::ODF) at xmloff/source/text/txtparae.cxx:1814
#2  0x00007fffec069554 in XMLTextParagraphExport::exportText(com::sun::star::uno::Reference<com::sun::star::text::XText> const&, com::sun::star::uno::Reference<com::sun::star::text::XTextSection> const&, bool, bool, bool)
    (this=0x1a76150, rText=uno::Reference to (SwXCell *) 0x50e7da0, rBaseSection=empty uno::Reference, bAutoStyles=true, bIsProgress=true, bExportParagraph=true)
    at xmloff/source/text/txtparae.cxx:1700
#3  0x00007fffcad4f8e8 in XMLTextParagraphExport::collectTextAutoStyles(com::sun::star::uno::Reference<com::sun::star::text::XText> const&, com::sun::star::uno::Reference<com::sun::star::text::XTextSection> const&, bool)
    (this=0x1a76150, rText=uno::Reference to (SwXCell *) 0x50e7da0, rBaseSection=empty uno::Reference, bIsProgress=true) at include/xmloff/txtparae.hxx:460
#4  0x00007fffcad49f01 in SwXMLExport::ExportTableLinesAutoStyles(SwTableLines const&, unsigned int, unsigned int, rtl::OUString const&, SwXMLTableColumnsSortByWidth_Impl&, SwXMLTableFrameFormatsSort_Impl&, SwXMLTableFrameFormatsSort_Impl&, SwXMLTableInfo_Impl&, bool)
    (this=0x4de4ae0, rLines=..., nAbsWidth=9412, nBaseWidth=65535, rNamePrefix="Table2", rExpCols=..., rExpRows=..., rExpCells=..., rTableInfo=..., bTop=true)
    at sw/source/filter/xml/xmltble.cxx:695
#5  0x00007fffcad4a8f5 in SwXMLExport::ExportTableAutoStyles(SwTableNode const&) (this=0x4de4ae0, rTableNd=...) at sw/source/filter/xml/xmltble.cxx:750
#6  0x00007fffcad4d103 in SwXMLTextParagraphExport::exportTableAutoStyles() (this=0x1a76150) at sw/source/filter/xml/xmltble.cxx:1162

at #6 we are doing....
for (const auto* pTableNode : maTableNodes)
and at #1 we do...
maTableNodes.push_back(pTableNd);
so modify the maTableNodes we are iterating over
Comment 5 Julien Nabet 2020-08-20 13:33:07 UTC
Created attachment 164495 [details]
Valgrind trace

Here's a Valgrind trace from pc Debian x86-64 with master sources updated with same commit as bt but without enable-dbgutil.
Comment 6 Mike Kaganski 2020-08-20 22:11:11 UTC
Please check if this fixes the problem: https://gerrit.libreoffice.org/c/core/+/101096
Comment 7 Julien Nabet 2020-08-21 07:43:31 UTC
(In reply to Mike Kaganski from comment #6)
> Please check if this fixes the problem:
> https://gerrit.libreoffice.org/c/core/+/101096

Indeed! I don't reproduce the crash with this patch and I got an odt document in instdir/program.
Comment 8 Mike Kaganski 2020-08-21 07:46:18 UTC
(In reply to Julien Nabet from comment #7)
> Indeed! I don't reproduce the crash with this patch

Thanks!

> and I got an odt document in instdir/program.

Sorry, not sure I understand what you mean: does the patch create some ODT in instdir/program? it should not...
Comment 9 Julien Nabet 2020-08-21 07:54:05 UTC
(In reply to Mike Kaganski from comment #8)
> ...
> > and I got an odt document in instdir/program.
> 
> Sorry, not sure I understand what you mean: does the patch create some ODT
> in instdir/program? it should not...

Yes it did.
I thought it was ok since I launched:
./soffice.bin --headless --convert-to odt /tmp/5f89318bb1b0a7ec46a91126e4db1157.docx from:
instdir/program
Comment 10 Mike Kaganski 2020-08-21 07:56:45 UTC
(In reply to Julien Nabet from comment #9)

Ah, so I think I understand now: the patch does not create ODTs in program directory itself (and that's good), and running the --convert-to command creates the file (as expected), so everything works as it should?
Comment 11 Julien Nabet 2020-08-21 08:00:56 UTC
(In reply to Mike Kaganski from comment #10)
> (In reply to Julien Nabet from comment #9)
> 
> Ah, so I think I understand now: the patch does not create ODTs in program
> directory itself (and that's good), and running the --convert-to command
> creates the file (as expected), so everything works as it should?

I suppose so but I'll let Caolán have the last word :-)
Comment 12 Caolán McNamara 2020-08-21 09:42:50 UTC
seems fine to me
Comment 13 Commit Notification 2020-08-21 12:19:15 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f0286ad82465152b29bba01ab2edeb97291397fa

tdf#135942: avoid collecting autostyles during writing them

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2020-08-21 17:58:45 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/0273675e7dde577077ccca17571846a0942f2630

tdf#135942: avoid collecting autostyles during writing them

It will be available in 7.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2020-09-23 11:36:44 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/63fba1ef338f14e2451baf039e0ae30d992b6743

tdf#135942: avoid collecting autostyles during writing them

It will be available in 6.4.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Xisco Faulí 2020-10-06 12:54:50 UTC
*** Bug 137103 has been marked as a duplicate of this bug. ***