Issue 127803

Summary: attempt to link documents circularly freezes writer
Product: Writer Reporter: yury_t <yury.tarasievich>
Component: codeAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P5 (lowest) CC: dronenglish, matt.dekenah, oooforum, petko
Version: 4.2.0-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Screenshot showing OpenOffice CPU usage upon circular reference freeze
none
Crash report as described in Comment 3. none

Description yury_t 2018-06-29 09:52:50 UTC
Replication:

Create and save two empty docs. In the 1st doc, insert a section and 'link' its contents to the 2nd doc. Save the 1st doc.

In the 2nd doc, 'insert' a 'section', set 'link' checkbox, set 'file name' to the 1st doc.

After clicking 'Insert', Writer freezes with maximum cpu usage.

Expected result: Writer recognises the attempt to back-link and -- this is just an idea -- blocks the 'links update' functionality for the offending content, with an informational message. But surely not use up all the resources.
Comment 1 oooforum (fr) 2018-07-09 09:50:54 UTC
Well, this is a "deadlock".

> this is just an idea -- blocks the 'links update' functionality
> for the offending content, with an informational message. 
Good idead!
So you can propose a patch to fix.
Comment 2 dronenglish 2018-11-17 21:39:20 UTC
Was able to recreate this issue today with Yury's steps. Windows 7 and 4.2.0
Comment 3 Matt 2019-05-10 23:54:55 UTC
Created attachment 86679 [details]
Screenshot showing OpenOffice CPU usage upon circular reference freeze


I have been able to replicate the issue as described on MacOS 10.14.4 and OpenOffice AOO416m1(Build:9790), Rev. 1844436, however, I have also seen a related issue where Writer actually crashes if both documents are open when the circular reference is inserted. See below.

Replication steps:
1. Create new Writer document.
2. Save to disk as e.g. Doc01.odt.
3. Create another new Writer document.
4. Save to disk as e.g. Doc02.odt.
5. Return to/open the first document.
6. Insert > Section...
7. Check the 'Link' checkbox and use the browse feature to select the second document.
8. Save then close the first document.
9. Open the second document.
10. Insert > Section...
11. Check the 'Link' checkbox and use the browse feature to select the first document.
12. Click 'Insert'.

At this point by monitoring OpenOffice in MacOS Activity Monitor I saw the CPU usage increase dramatically and Writer become unresponsive (see attached screenshot). Memory usage also began to increase exponentially.

I also attempted to alternative steps where I did not close the first document at step 8. On my OS (see configuration details below), this resulted in a crash of OpenOffice instead of OO becoming unresponsive and consuming more resources. I will attach the crash report as a second comment.

(After the program crash or force quit, OpenOffice offered to recover the document(s) and did so successfully.)

Configuration:
macOS 10.14.4 (18E227)
Model Identifier: MacBookPro15,2
Processor Name: Intel Core i7
Processor Speed: 2.7 GHz
RAM: 16GB

OpenOffice Version: 
AOO416m1(Build:9790)  -  Rev. 1844436
2018-10-22 14:11:36 (Mon, 22 Oct 2018) - Darwin x86_64
Comment 4 Matt 2019-05-10 23:55:55 UTC
Created attachment 86680 [details]
Crash report as described in Comment 3.
Comment 5 Peter 2019-05-12 07:22:44 UTC
non the less we can set it on confirm