Bug 93356 - [CRASH] SORTING columns in Calc causes crash
Summary: [CRASH] SORTING columns in Calc causes crash
Status: RESOLVED DUPLICATE of bug 93098
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.5.2 release
Hardware: x86-64 (AMD64) All
: highest critical
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 93655 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-08-11 13:44 UTC by Elmar
Modified: 2016-10-10 12:02 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
example sort file (42.24 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-08-11 13:44 UTC, Elmar
Details
WinDbg output from crash in LO 5.0.1.2 on "example sort file" (Attachment 117827) (21.27 KB, text/plain)
2015-09-02 12:26 UTC, gekacheka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elmar 2015-08-11 13:44:09 UTC
Created attachment 117827 [details]
example sort file

similar to 92787, but happens every time (but not on a simple single column test list).
Attempt to SORT immediately crashes Calc.
Comment 1 Elmar 2015-08-13 12:39:30 UTC
Not sure if this has any bearing on the problem - opened an xls created with MSExcel in LO Calc. Sorted without any issue.

Same result with the same file saved as xlsx using MSExcel.

I installed OO 4.1.1
I am not having any issues with the .ods files.
Comment 2 sophie 2015-08-19 14:05:35 UTC
Hi, could you give us steps to reproduce? I've tried to sort your file by date and didn't get any crash. On which range and which column are your sorting? Sophie
Comment 3 sophie 2015-08-19 14:06:30 UTC
added version. Sophie
Comment 4 gekacheka 2015-09-01 22:30:06 UTC
Crashed for me.  (I have experienced crashes try to sort rows in one of my files also.)

LO 5.0.1.2
Win-x86

Steps to reproduce
1. In LO Calc, opened the "example sort file" (2015-08-11 13:44 UTC)
   (Answered "No" to dialog about updating links.)
2. Selected data rows 5 through 77 
   (clicked 5 in left margin, scrolled down, shift-clicked 77 in left margin.)
3. Menu Data / Sort ...

4. Alternative A: sort descending by date

     Sort Key 1:  selected Column E (the date column), 
     and selected (*) Descending 
     (descending is important, because it is already sorted in ascending order,
      and didn't crash if it was left Ascending.)

   Alternative B: sort ascending by description

     Sort Key 1: selected Column F (the description column)
     and left (*) Ascending as is.


5. Clicked OK.

CRASHED (Sort dialog and Calc spreadsheet window both disappear.)

(Often the document recovery dialog appears, but not always.)

(On my file, it also crashed in LO 5.0.0.5? and LO 4.4.5.2.)
Comment 5 gekacheka 2015-09-02 02:31:27 UTC
LO did NOT crash for me on the above steps with the development build
master~2015-09-01_06.18.16_LibreOfficeDev_5.1.0.0.alpha1_Win_x86
(and opening the file from inside LO).

(I found the possibly unstable development build after following instructions on
 https://wiki.documentfoundation.org/How_to_get_a_backtrace_with_WinDbg
 , near the bottom.  It worked after I figured out that it installs into
 a separate directory.  It does not override the current install.
 Opening the file from Windows explorer or the start menu 
 will not use the development build.)
Comment 6 Alex Thurgood 2015-09-02 04:59:59 UTC
*** Bug 93655 has been marked as a duplicate of this bug. ***
Comment 7 Alex Thurgood 2015-09-02 05:02:58 UTC

*** This bug has been marked as a duplicate of bug 84636 ***
Comment 8 gekacheka 2015-09-02 11:49:50 UTC
Alex, Thanks for the triage efforts, but I don't think this is a duplicate of bug 84636.
* This crash happens always, 
  bug 84636 was intermittent.
* In LO 5.0.1.2, the example in this bug always crashes for me, 
  but I was unable to reproduce a crash on the example given in bug 84636.
* (I don't know whether the external file storage type makes a difference,
   but this bug example is .ods,
   and bug 84636 example is .xlsx.) 

Reverting to NEW for now.

[If this bug is indeed fixed when 5.1 is released (see comment #5), I expect it could be resolved as worksforme, unless a specific fixed bug can be found.]
Comment 9 gekacheka 2015-09-02 12:26:40 UTC
Created attachment 118346 [details]
WinDbg output from crash in LO 5.0.1.2 on "example sort file" (Attachment 117827 [details])

This WinDbg includes STACK_TEXT that looks similar to
Bug 93655, Attachment 118172 [details],  Thread 0, leading up to ScTable::SortReorderByRow
(in case someone may recognize the bug that hopefully fixed this bug [comment 5]).
Comment 10 gekacheka 2015-09-02 13:05:25 UTC
(Unlike Bug 93655 comment 3 workround,) 
Sorting a rectangular region rather than rows still causes a crash on this bug's example.  I repeated steps from this bug comment 4, again on "example sort file" Attachment 117827 [details], 
except in step 2, I clicked cell A5, then shift-clicked cell X77, to select the rectangular region containing data cells, not full rows.
(The WinDbg output is the same, ignoring differences in hexadecimal data/addresses.)

Since this bug seems to appear on Linux, Windows, and MacOS (bug 93655), changed OS to all.
Comment 11 Marco Alici 2015-09-02 16:14:21 UTC
I had a crash in Calc 5.0.0.5 x86/64 under Windows 7.

This is the file a friend sent to me (sorry, everything is in Italian):
http://bit.ly/1NauOIF

It's made in MS Excel. I try to save in ODS but same issue.

1) select cells A8:H13 in the second sheet (called "Gruppi gara1")
2) sort by "PROG".

The program closes.

The problem occurrs even selecting other groups of cells.
Comment 12 Robinson Tryon (qubit) 2015-09-02 17:42:00 UTC
LO 5.0.1.2 + Ubuntu 14.04

(In reply to gekacheka from comment #4)
> Steps to reproduce
> 1. In LO Calc, opened the "example sort file" (2015-08-11 13:44 UTC)
>    (Answered "No" to dialog about updating links.)
> 2. Selected data rows 5 through 77 
>    (clicked 5 in left margin, scrolled down, shift-clicked 77 in left
> margin.)
> 3. Menu Data / Sort ...
> 
> 4. Alternative A: sort descending by date
> 
>      Sort Key 1:  selected Column E (the date column), 
>      and selected (*) Descending 
>      (descending is important, because it is already sorted in ascending
> order,
>       and didn't crash if it was left Ascending.)

Chose this one

> 
>    Alternative B: sort ascending by description
> 
>      Sort Key 1: selected Column F (the description column)
>      and left (*) Ascending as is.
> 
> 
> 5. Clicked OK.
> 
> CRASHED (Sort dialog and Calc spreadsheet window both disappear.)

Yes, CRASH confirmed.
Same results with LO 5.0.0.5.

Changing Priority -> highest

(In reply to gekacheka from comment #5)
> LO did NOT crash for me on the above steps with the development build
> master~2015-09-01_06.18.16_LibreOfficeDev_5.1.0.0.alpha1_Win_x86

I'll check with a daily build as well
Comment 13 Elmar 2015-09-03 13:32:16 UTC
Just in case, I removed LO and then reinstalled again; version is 
Version: 5.0.1.2
Build ID: 00m0(Build:2)
Locale: en-GB (en_ZA.UTF-8)

I was not having this problem on the default version (Linux Mint 17.2 Cinnamon)

This may add light to darkness:
I have been playing around with the calc file I originally submitted. Tried various ways to see if I could stop it from crashing.
FINALLY!

Using the same file as I uploaded (testsort.ods)
I select from A5:Q8
Sort
Extend the selection to R8 (the first column to have a formula)
Sort
Now I can select any block or set of rows and sort without crashing.

I then tried this on a large file of data
Here, I had to select from A5:Qlastdatarow
sort on colF
extend to colR (first formula column)
sort on colQ
after this, I could sort anywhere randomly

But this needs to be repeated for each sheet

If I save the file to a new name, the "fixed" sheet is OK, but Calc crashes on sheets that have not been fixed.

Note that when I open the file using OO-Calc there is no crashing

I hope this leads somewhere
Comment 14 Robinson Tryon (qubit) 2015-09-03 14:22:46 UTC
TESTING on Ubuntu 14.04 + LO Version: 5.1.0.0.alpha1+
Build ID: 452b1872af72d7fb31101aa2fa35aeaf18e41a10
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2015-09-02_08:11:07

(In reply to Robinson Tryon (qubit) from comment #12)
> > Steps to reproduce
> > 1. In LO Calc, opened the "example sort file" (2015-08-11 13:44 UTC)
> >    (Answered "No" to dialog about updating links.)
> > 2. Selected data rows 5 through 77 
> >    (clicked 5 in left margin, scrolled down, shift-clicked 77 in left
> > margin.)
> > 3. Menu Data / Sort ...
> > 
> > 4. Alternative A: sort descending by date
> > 
> >      Sort Key 1:  selected Column E (the date column), 
> >      and selected (*) Descending 
> >      (descending is important, because it is already sorted in ascending
> > order,
> >       and didn't crash if it was left Ascending.)
> 
> Chose this one

Yep

> > 5. Clicked OK.
> > 
> > CRASHED (Sort dialog and Calc spreadsheet window both disappear.)

NO REPRO 

Seems to be fixed with 5.1, so
Status -> RESOLVED WORKSFORME

I'll leave Priority as highest, and add to Whiteboard: backportRequest:5.0 backportRequest:4.4

Elmar: My guess is this is a regression, so if the file sorting does not crash in 4.3, 4.2, or something older, we can mark it as such and then try to track down what commit introduced the problem.
Comment 15 Marco Alici 2015-09-03 14:55:54 UTC
Same problem occurs on Version: 5.0.1.2 (x64)Build ID: 81898c9f5c0d43f3473ba111d7b351050be20261
Comment 16 gekacheka 2015-09-03 16:12:52 UTC
The two stack traces both lead up to ScTable::SortReorderByRow
(WinDbg: attachment 118346 [details], Mac: bug 93655 attachment 1181172)

ScTable::SortReorderByRow is in table3.cxx
http://cgit.freedesktop.org/libreoffice/core/tree/sc/source/core/data/table3.cxx#n1044

table3.cxx was modified 2015-08-13 for bug 93098
http://cgit.freedesktop.org/libreoffice/core/log/sc/source/core/data/table3.cxx

bug 93098 "Unexpectedly quit when use Data->Sort (crash)"
is a similar problem and is marked FIXED.

bug 93098 comment 10 says the fix was committed to master 2015-08-13 for 5.1.
bug 93098 comment 15 says the fix was committed to 5-0 2015-08-17 for 5.0.2.
bug 93098 comment 17 says the fix was committed to 4-4 2015-08-17 for 4.4.6.

No daily builds were available from just before and after these commits.

The oldest daily build found for preparing 4.4.6 was 2015-08-20, and it works.
The oldest daily build found for preparing 5.0.2 was 2015-08-20, and it works.

Based on this partial evidence, marking this a duplicate of bug 93098.

-----------
(
 Latest previous release that does not crash when sorting examples like this:
 LO 4.4.4.1 or earlier do NOT crash on sorting this example,
 while LO 4.4.4.2 or later DO CRASH on sorting this example.
 If a later version is installed, uninstall it before installing earlier one.
 http://downloadarchive.documentfoundation.org/libreoffice/old/4.4.4.1/
)

(
 Possible dates of future releases with fix for this problem:
 LO 5.1 release schedule is not yet defined.
 LO 5.0.2 is scheduled to be published near the end of September 2015.
 LO 4.4.6 is scheduled to be published near the middle of October 2015.
 https://wiki.documentfoundation.org/ReleasePlan
)

*** This bug has been marked as a duplicate of bug 93098 ***