Bug 114342 - Crash while opening a document
Summary: Crash while opening a document
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.0.0.0.beta1
Hardware: All Linux (All)
: highest critical
Assignee: Caolán McNamara
URL:
Whiteboard: target:6.1.0 target:6.0.0.1
Keywords: bibisected, bisected, haveBacktrace, regression
: 114514 (view as bug list)
Depends on:
Blocks: Calc-Threaded
  Show dependency treegraph
 
Reported: 2017-12-08 13:37 UTC by Elmar
Modified: 2017-12-18 09:07 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
doc crashes on opening in v6.1 (24.29 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-12-08 13:38 UTC, Elmar
Details
gdb backtrace (10.99 MB, text/plain)
2017-12-08 16:20 UTC, Xisco Faulí
Details
bt with debug symbols (22.23 KB, text/plain)
2017-12-09 19:35 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elmar 2017-12-08 13:37:33 UTC
Description:
Version: 6.1.0.0.alpha0+
Build ID: 1d8cb97fea57b81a1ab151b88c2180e646bd401b
CPU threads: 4; OS: Linux 4.10; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2017-12-07_01:51:53
Locale: en-ZA (en_ZA.UTF-8); Calc: group threaded

crashes immediately when open document

However, in v5.4 it works without a problem.

If save to xlsx format and then open that in v6.1 it opens fine.


Steps to Reproduce:
1. open test document
2. document does not open in v6.1
3.

Actual Results:  
doc does not open

Expected Results:
doc should open


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Comment 1 Elmar 2017-12-08 13:38:34 UTC
Created attachment 138308 [details]
doc crashes on opening in v6.1
Comment 2 Elmar 2017-12-08 13:58:21 UTC
I then opened the document in v5.4
opened up a new spreadsheet in v6.1
Then I selected all the cells that are used 
Copy the cells to new doc 
save the file
open the new saved file
opens fine in v6.1
Comment 3 Xisco Faulí 2017-12-08 15:11:58 UTC
Regression introduced by:

author	Tor Lillqvist <tml@collabora.com>	2017-10-04 12:40:20 +0300
committer	Dennis Francis <dennis.francis@collabora.co.uk>	2017-11-21 16:09:42 +0530
commit	5222910f969390c64c18866834d9af53e7c4c189 (patch)
tree	51b5104ddb0a1bde71cccd99b0e97584e4b0e536
parent	fd9d991ec02c3df178220031be6bd8b38c6c2c23 (diff)
Make threaded calculation the default (when OpenCL is not used)
Introduce a configuration setting to turn it off. For now, can also be
turned off with the environment variable SC_NO_THREADED_CALCULATION,
but that is probably not something we want to keep or guarantee
staility of. (LO looks at way too many environment variables already.)

Bisected with: bibisect-linux64-6.0

Adding Cc: to Tor Lillqvist
Comment 4 Xisco Faulí 2017-12-08 16:20:54 UTC
Created attachment 138313 [details]
gdb backtrace
Comment 5 Julien Nabet 2017-12-09 19:35:42 UTC
Created attachment 138332 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today + enable-dbgutil, I also got a crash but with a different bt.
Comment 6 Julien Nabet 2017-12-09 21:55:36 UTC
It's a stack overflow.
After having found that UseThreadedCalculationForFormulaGroups returned 1, I used this patch just for the test:
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 955be80b4c59..9d4c3a97cd40 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -4344,7 +4344,7 @@ bool ScFormulaCell::InterpretFormulaGroup()
 
     if (!bThreadingProhibited && !ScCalcConfig::isOpenCLEnabled() &&
         pCode->GetVectorState() == FormulaVectorEnabledForThreading &&
-        officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get())
+        officecfg::Office::Calc::Formula::Calculation::UseThreadedCalculationForFormulaGroups::get() && false)
     {
         // iterate over code in the formula ...
         // ensure all input is pre-calculated -

I could open the file.

Now I don't know how to fix this.
Comment 7 Commit Notification 2017-12-11 09:21:19 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

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

tdf#114342 move recursion guard to encompass threaded path too

It will be available in 6.1.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 8 Caolán McNamara 2017-12-11 09:32:41 UTC
backport to 6-0 in gerrit
Comment 9 Commit Notification 2017-12-11 10:11:35 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a63e8a7fa3b0f98501e8bc20a1adf6ca235a7dd1&h=libreoffice-6-0

tdf#114342 move recursion guard to encompass threaded path too

It will be available in 6.0.0.1.

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 10 Xisco Faulí 2017-12-11 12:11:02 UTC
Verified in

Version: 6.1.0.0.alpha0+
Build ID: 3af500580b1c82eabd60335c9ebc458a3f68850c
CPU threads: 4; OS: Linux 4.10; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded
Comment 11 Xisco Faulí 2017-12-18 09:05:43 UTC
*** Bug 114514 has been marked as a duplicate of this bug. ***