Issue 118863 - [From Symphony] Calc stop responding if paste merged celss to a column
Summary: [From Symphony] Calc stop responding if paste merged celss to a column
Status: CONFIRMED
Alias: None
Product: Calc
Classification: Application
Component: ui (show other issues)
Version: 3.4.0 Beta (OOo)
Hardware: PC Windows 7
: P2 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-02 07:21 UTC by Yan Ji
Modified: 2017-05-20 11:55 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
patch for the issue (8.93 KB, patch)
2012-05-21 07:06 UTC, Lei Debin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Yan Ji 2012-02-02 07:21:03 UTC
steps:
1. Start Calc, and new a spreadsheet document.
2. Merge cell A1 and B1.
3. Input data to cell A1, A2 and B2
4. Copy cells A1: B2
5. Click column header to select the whole column, e.g. Column E.
6. Paste cells copied in step 4

Defect: Application stop responding.
Comment 1 Yan Ji 2012-02-07 02:10:04 UTC
The problem can be reproduced.
Comment 2 Lei Debin 2012-05-21 07:06:05 UTC
Created attachment 77571 [details]
patch for the issue

The root cause for the issue is the memory allocation cost too much time for the operation.
So we need pre-calculated needed memory and pre-reserve enough memory for it.
The time will reduce from 30min to 10s on my Lenovo 9196 desktop machine.
Comment 3 Wang Lei 2012-06-08 09:07:07 UTC
Thanks for your patch. I will review it.
Comment 4 Wang Lei 2012-06-12 08:52:02 UTC
When I review bug i118863 (https://issues.apache.org/ooo/show_bug.cgi?id=118863), I find there are some other related user cases which can get AOO crash or freeze.

Scenario 1
1)New a calc doc.
2)Input 1, 2, 3 in cell A1, A2, A3
3)Set background color for cell A1, A2, A3 as blue, green, red
4)Select A1:A3, and copy
5)Select a whole columnm, such as column E, and paste

AOO need more than 5 minutes to complete this work.
6)undo the paste
AOO also need a lot of time

Scenario 2
1)New a calc doc.
2)Input 1, 2, 3 in cell A1, A2, A3
3)Select A1:A3, and copy
4)Select another whole sheet, such as "sheet2", and paste

AOO will crash


Now Calc supoorts 1,048,576 rows * 1024 columns, which is 1,073,741,824 cells. Pasting with a whole column selected will fill the column. Pasting with a whole sheet selected will fill the sheet, which always casue AOO crash.

I have two suggestions

Solution 1
Disable auto repeat to fill cells when pasting with a whole column/sheet selected. Considering user may not want to repeat to fill the cells when pasting with a whole column/sheet selected, just paste the source data and do not repeat to fill.

Excel has a strange behavior. It will not repeat to fill cells, if the cell numbers in target range is not integer multiple of the source data.
For an example,
Copy A1:A2, Select B1:B10, Ctrl+V -> B1:B10 will be filled
Copy A1:A2, Select B1:B11, Ctrl+V -> Only B1:B2 will be filled
So when pasting with a whole column/sheet selected, sometimes Excel will repeat to fill the whole column/sheet, sometimes it will not.


Solution 2
Set two thresholds, one is for warning user, one is for the limitation.
If number of cells in target range is bigger than warning threshold, Calc will popup a warning message to warn user the potential bad performance. If number of cells in target range is bigger than limitation, Calc will popup a error message to info user the operation can not be completed.

The purpose of Solution 1/Solution 2 is to avoid making Calc crash for careless operation(paste with a whole column/sheet selected).

This is a great patch to improve the performance. But if we change the behavior, the improvement may not useful.

What is your opinion?
Comment 5 jkfidel 2013-11-15 03:26:00 UTC
I have replicated the bugs in comments 1 and 4 with the following configuration and build:

Apache OpenOffice 4.0.1; AOO401m5(Build:9714) - Rev. 1524958
Windows 7 Ultimate 64-bit, Service Pack 1
Intel Core 2 Duo T6600 2.20 GHz, 4GB RAM

I have also found a problem in a somewhat simpler situation:
1.	Create a new sheet.
2.	Merge cells A1 and B1.
3.	Copy cells A1:A2
4.	Click on a column header, e.g. Column E.
5.	Paste.

Result: 
Calc stops responding.

A follow-up test:
1.	Repeat steps 1-2 above only.
2.	Copy cells A1:A2.
3.	Click on a column header, e.g. Column E.
4.	Paste.
Result:
No crash or significant waiting.  Columns E-F are merged.

Comments:
Based on these results and the results of prior comments, it is not necessary to have data in any of the copied cells to initiate the crash.  However, it is necessary to copy and paste both merged cells and unmerged cells  into an entire column in order  initiate a crash. 

Implications:
Any crash is problematic for a user due to the potential to lose unsaved work.  However, it is probably unlikely that a user will try to paste a merged and unmerged cell into an entire selected column.
Comment 6 jkfidel 2013-11-15 05:09:08 UTC
A correction to my Comment 5...
The steps for "A follow-up test" should read:
1.	Repeat steps 1-2 above only.
2.	Copy cells A1:B1. (vice A1:A2)
3.	Click on a column header, e.g. Column E.
4.	Paste.