Bug 88849 - FILEOPEN: hang when try to open a specific XLSX
Summary: FILEOPEN: hang when try to open a specific XLSX
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.0.0.0 beta1
Hardware: All All
: high major
Assignee: Markus Mohrhard
URL:
Whiteboard: target:5.2.0
Keywords: bibisected, bisected, filter:xlsx, haveBacktrace, perf, regression
Depends on:
Blocks:
 
Reported: 2015-01-28 11:17 UTC by Marina Latini (SUSE)
Modified: 2016-10-25 19:07 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
problematic file (189.82 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2015-09-15 13:03 UTC, Xisco Faulí
Details
backtrace during the loop (13.52 KB, text/plain)
2015-09-23 03:52 UTC, Terrence Enger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marina Latini (SUSE) 2015-01-28 11:17:46 UTC
I have a business xlsx file with complex formulas. In particular there are:
* matrix with nested indirect references
* formulas that refer to a query from Excel.

This xlsx file contains links to other files. You can click both "no" and "yes" because the behaviour is the same.

I can't open the document with a LibreOffice version bigger then 3.6.7.2. All the 4.X versions hang during opening while LibreOffice 3.6.7.2 opens the file with some errors.

I can provide the xlsx file and 3 screenshots of the document opened with Office365 and LibreOffice 3.6.7.2.

file to test: https://www.dropbox.com/s/4rmc162mgjisd4a/01%20CLEAN.xlsx?dl=0

Screenshot from Office365: https://www.dropbox.com/s/ws8rr3mj6juouuo/01Clean_Office365.png?dl=0
Screenshot from LibreOffice 3.6.7.2 (query): https://www.dropbox.com/s/00xnspejrrk1nfd/01CleanLibO-query3672.png?dl=0
Screenshot from LibreOffice 3.6.7.2 (matrix with indirect): https://www.dropbox.com/s/h5qtxf6ji9u71n2/01CleanLibO-indirect3672.png?dl=0

I tested the files on my Ubuntu 14.04 x86_64 and on Windows Server 2012 R2
All the tests made on LibreOffice:
* Version: 3.6.7.2 
* Build ID: e183d5b
* locale: it_IT

* Version 4.0.0.0.beta1 
* Build ID: 87906242e87d3ddb2ba9827818f2d1416d80cc7
* locale: it_IT

* Version: 4.2.8.2
* Build ID: 48d50dbfc06349262c9d50868e5c1f630a573ebd
* Locale: it_IT

* Version: 4.3.5.2
* Build ID: 3a87456aaa6a95c63eea1c1b3201acedf0751bd5
* Locale: it_IT

* Version: 4.3.6.1
* Build ID: 9629686a67dd1f357477c13325e45a66f3452bb9
* locale: it_IT

* Version: 4.4.0.3
* Build ID: de093506bcdc5fafd9023ee680b8c60e3e0645d7
* locale: it_IT

* Version: 4.5.0.0.alpha0+
* Build ID: 784d069cc1d9f1d6e6a4e543a278376ab483d1eb
* TinderBox: Linux-rpm_deb-x86_64@46-TDF-dbg, Branch:master, Time: 2015-01-25_23:58:40
* Locale: it_IT
Comment 1 Pedro 2015-01-28 17:18:24 UTC
Bug confirmed under Windows XP x86 (so switching Hardware from x64 to All) with versions 

Version: 4.4.0.3
Build ID: de093506bcdc5fafd9023ee680b8c60e3e0645d7
Locale: pt_PT

(locks and will not open the file)

Version 3.6.7.2 (Build ID: e183d5b)

(opens with errors)

Since this is a regression from branch 3.6 (which at least opens the file), I'm marking as a Regression
Comment 2 Matthew Francis 2015-01-29 05:11:04 UTC
Bibisect results from 43all:
 8a8370d143cc6c103ed5bf21b849bb7b8309618d is the first bad commit
commit 8a8370d143cc6c103ed5bf21b849bb7b8309618d
Author: Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
Date:   Mon Dec 10 16:20:16 2012 +0000

    source-hash-69222d71221d0ec81a3dbf01789456bcf2dde0da
    
    commit 69222d71221d0ec81a3dbf01789456bcf2dde0da

# bad: [423a84c4f7068853974887d98442bc2a2d0cc91b] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
# good: [cf86b7f14a98d2d81a5cd93507acb35ff6775d8b] source-hash-85c6244b85b29c1d2bb9d89b62e9512dd65378b5
git bisect start 'latest' 'last35onmaster'
# bad: [34eab3946c46bb7273ba4ca395db9c4421dd232f] source-hash-e962805b31074d6b6a2ed0db6452769448337553
git bisect bad 34eab3946c46bb7273ba4ca395db9c4421dd232f
# bad: [2e2d1aeff80dcbe390f6c3fbc54d6c8de81b0a0e] source-hash-64ab96cd15e52da88781e720d6f031dbcd0ba902
git bisect bad 2e2d1aeff80dcbe390f6c3fbc54d6c8de81b0a0e
# skip: [a7a51689878f5428c3934558f820fb65af04fedb] source-hash-2a360b68475d6fff5b6618feddb0b52f3a4a2373
git bisect skip a7a51689878f5428c3934558f820fb65af04fedb
# skip: [084a70662df54cc8802bb2f682045436c911f78d] source-hash-4f5c523b97542bdbfe69fb7695bcb9699c66f89f
git bisect skip 084a70662df54cc8802bb2f682045436c911f78d
# good: [829387df44370e9da25094d901fbea67f8f18614] source-hash-ecb1599ad00e71dfe05f3ae9a71bdce5f7540a40
git bisect good 829387df44370e9da25094d901fbea67f8f18614
# skip: [e270c448410216194de63a2e4c2a16cb6f9a89dd] source-hash-77987eacff20dec40caf29aae61d262239d441e9
git bisect skip e270c448410216194de63a2e4c2a16cb6f9a89dd
# good: [f3986117cf91f1976749922e435915354389c4f1] source-hash-eab7e131ecebe4cdefcdcb1ad176bbdce83cb467
git bisect good f3986117cf91f1976749922e435915354389c4f1
# skip: [7be7cf83087144563a18000acdae82c8fd6f4872] source-hash-d59024b652ccfaf7247da113ec36788fe260de74
git bisect skip 7be7cf83087144563a18000acdae82c8fd6f4872
# skip: [89740762f0af849e492932bd71e59149cdcd5a00] source-hash-06f20d73da21342046a480a6b22af69901351328
git bisect skip 89740762f0af849e492932bd71e59149cdcd5a00
# good: [113bce8fc413d543d6e00747ebe924e83788f810] source-hash-24c125f4de208e4093198d32e2e3b7faae4470fa
git bisect good 113bce8fc413d543d6e00747ebe924e83788f810
# skip: [489397741e799a5ad767e4b12be827c8c96ba60b] source-hash-50b4cbe94e200288d57a135bc9386012164bc726
git bisect skip 489397741e799a5ad767e4b12be827c8c96ba60b
# skip: [8f4aeaad2f65d656328a451154142bb82efa4327] source-hash-1885266f274575327cdeee9852945a3e91f32f15
git bisect skip 8f4aeaad2f65d656328a451154142bb82efa4327
# skip: [8641cbd807db765b43d4b98f8865ebf34bc1c4ca] source-hash-57c3b583f1f69edd32b2a54253850e1b3b202255
git bisect skip 8641cbd807db765b43d4b98f8865ebf34bc1c4ca
# skip: [cd18cb7f47f7e956c6d19bd0f31a6e30d1173b29] source-hash-558476135865d9ae7b8801a82c177fd1098386ff
git bisect skip cd18cb7f47f7e956c6d19bd0f31a6e30d1173b29
# bad: [67a1700cf48455c8b0a2411ab01433f405866161] source-hash-d18455e24644a90cbf9f146ea8b4eed74180592b
git bisect bad 67a1700cf48455c8b0a2411ab01433f405866161
# good: [8bbb7fdee456f8cd35d6d96ad85101c04eb1e064] source-hash-fba5febdf60b37be69d2ffc66445d3e324826346
git bisect good 8bbb7fdee456f8cd35d6d96ad85101c04eb1e064
# bad: [3f671257a6a03a127026500b9aa48670dbb000df] source-hash-968ed85d7304fe0044d3f82af20ae7190ad3c33d
git bisect bad 3f671257a6a03a127026500b9aa48670dbb000df
# bad: [8a8370d143cc6c103ed5bf21b849bb7b8309618d] source-hash-69222d71221d0ec81a3dbf01789456bcf2dde0da
git bisect bad 8a8370d143cc6c103ed5bf21b849bb7b8309618d
# good: [6d5c8da992dd6f7af0bda654787652a9221659e8] source-hash-4df639baacd871cb2793e75dd9721ad2ae715e20
git bisect good 6d5c8da992dd6f7af0bda654787652a9221659e8
# first bad commit: [8a8370d143cc6c103ed5bf21b849bb7b8309618d] source-hash-69222d71221d0ec81a3dbf01789456bcf2dde0da
Comment 3 Matthew Francis 2015-01-29 06:03:02 UTC
The hang appears to have been introduced by the below commit.

Adding Cc: to bubli@bubli.org; Could you possibly take a look at this one? Thanks


commit 010e207039cc12bf7c688d978adeb16c0802333e
Author: Katarina Behrens <bubli@bubli.org>
Date:   Sat Sep 29 20:09:42 2012 +0200

    fdo #50343: Fixed crash on xlsx import of file with array formula
    
    Follow-up of 7fff98724bc7e3. Buffer only cell formula values via
    setCellFormulaValue. Otherwise we get crash in
    FormulaBuffer::applyCellFormulaValues() as array/shared/datatable
    formulas are treated differently
    
    Change-Id: Ie344b273ec662e8af1bf9fa54e79614393634974
Comment 4 Matthew Francis 2015-01-29 06:04:22 UTC
...once more with the actual Cc: to bubli@bubli.org

This hang appears to have been introduced by the above mentioned commit 010e207039cc12bf7c688d978adeb16c0802333e. Could you possibly take a look? Thanks
Comment 5 Xisco Faulí 2015-09-15 13:03:25 UTC
Created attachment 118741 [details]
problematic file

This issue is still present in

Version: 5.0.1.2
Build ID: 81898c9f5c0d43f3473ba111d7b351050be20261
Locale: es-ES (es_ES)

on Windows 7 (64-bit)
Comment 6 Terrence Enger 2015-09-16 13:03:02 UTC
Using locally build LibreOffice commit 9d24f6b, fetched 2014-10-14,
configured ...

    --enable-option-checking=fatal --enable-dbgutil --enable-crashdump
    --without-system-postgresql --without-myspell-dicts
    --with-extra-buildid --without-doxygen
    --with-external-tar=/home/terry/lo_hacking/git/src
    --disable-gstreamer --enable-gstreamer-0-10

the program displays three msgbox's.  First (newlines added) ...

    The file '01 CLEAN.xlsx?dl=1' is corrupt and therefore cannot be
        opened. LibreOfficeDev can try to repair the file.

    The corruption could be the result of document manipulation or of
        structural document damage due to data transmission.

    We recommend that you do not trust the content of the repaired
        document.  Execution of macros is disabled for this document.

    Should LibreOfficeDev repair the file?

Second ...

    The file '01 CLEAN.xlsx?dl=1' could not be repaired and therefore
        cannot be opened.

Third ... 

    General Error

And then the program quites.
Comment 7 Terrence Enger 2015-09-23 03:52:39 UTC
Created attachment 118957 [details]
backtrace during the loop

The backtrace is from master commit f78216d, fetched 2015-09-21 02:45
UTC, configured ...

    CC=ccache /home/terry/lo_hacking/associated/gcc/bin/gcc
    CXX=ccache /home/terry/lo_hacking/associated/gcc/bin/g++
    --enable-option-checking=fatal --enable-dbgutil --enable-crashdump
    --without-system-postgresql --without-myspell-dicts
    --with-extra-buildid --without-doxygen
    --with-external-tar=/home/terry/lo_hacking/git/src
    --disable-gstreamer-1-0 --enable-gstreamer-0-10 --disable-gtk3

built on debian wheezy but with gcc 5.2.0 its libraries, and running
chroot'ed to debian sid.

The program starts its long loop before the document appears in the
Writer window.

The busy loop is in frame #17 of the backtrace,
sc/source/core/tool/interpr5.cxx lines 1149 through 1162.  The upper
bound for the loop index is 1048576.
Comment 8 Terrence Enger 2015-09-23 03:53:23 UTC
Setting keyword have-backtrace.
Comment 9 Robinson Tryon (qubit) 2015-12-10 10:47:06 UTC Comment hidden (obsolete)
Comment 10 Buovjaga 2015-12-10 11:04:21 UTC
Still hangs.

Win 7 Pro 64-bit Version: 5.2.0.0.alpha0+
Build ID: 81fa5340191baf8687f9c82f1f414f5afc86b529
Threads 4; Ver: Windows 6.1; Render: default; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-12-03_21:19:19
Locale: fi-FI (fi_FI)
Comment 11 Markus Mohrhard 2016-02-16 00:40:18 UTC
Is this still a problem. One of my students did a lot of work to improve matrix operations in master and 5.1.
Comment 12 Buovjaga 2016-02-16 06:21:18 UTC
(In reply to Markus Mohrhard from comment #11)
> Is this still a problem. One of my students did a lot of work to improve
> matrix operations in master and 5.1.

Still hanging.

Win 7 Pro 64-bit, Version: 5.1.0.3 (x64)
Build ID: 5e3e00a007d9b3b6efb6797a8b8e57b51ab1f737
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
Locale: fi-FI (fi_FI)

Version: 5.2.0.0.alpha0+
Build ID: a6f876d45bd4e41a7143594a6cb11b6893a0f620
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-02-11_00:07:38
Locale: fi-FI (fi_FI)
Comment 13 Katarina Behrens (Inactive) 2016-02-16 08:34:29 UTC
Moreover, commit from comment 3 has likely very little to do with this bug, I've reverted it and it still hangs
Comment 14 Markus Mohrhard 2016-03-20 21:26:07 UTC
There are a number of issues exposed in the matrix backend by this file. I have fixes for some of them.
Comment 15 Commit Notification 2016-03-22 12:31:29 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=056be3551279a2e0e4d766e898e93ab500401da6

use an empty block as empty cell flag, related tdf#88849

It will be available in 5.2.0.

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 16 Commit Notification 2016-03-23 19:08:57 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=5c8991813dc303c7ffc8fef7d8d8f0779657fde6

better use mdds in matrix concat, tdf#88849

It will be available in 5.2.0.

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 17 Commit Notification 2016-04-15 17:20:02 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

add test for tdf#88849

It will be available in 5.2.0.

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 18 Commit Notification 2016-04-16 12:52:03 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

add test case for smaller MatConcat case, related tdf#88849

It will be available in 5.2.0.

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 19 Commit Notification 2016-04-16 23:46:31 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7fbeba2c4c1094204b5db7320dad8f667e291c01

fix last mdds perf problem in MatConcat, tdf#88849

It will be available in 5.2.0.

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 20 Marina Latini (SUSE) 2016-04-18 10:26:54 UTC
Verified as fixed on

* Version: 5.2.0.0.alpha0+
* Build ID: 101e5bbc8aaa77d5db36e0969a512b5a283f1672
* CPU Threads: 4; OS Version: Linux 4.5; UI Render: default; 
* TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-04-18_06:04:45
* Locale: it-IT (it_IT.UTF-8)
* OS: openSUSE Tumbleweed (20160117) (x86_64)