Bug 134157 - Edit with external tool causes a CPU hit
Summary: Edit with external tool causes a CPU hit
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.1.0.3 release
Hardware: All All
: medium normal
Assignee: Tomofumi Yagi
URL:
Whiteboard: target:7.1.0 target:7.0.2 target:6.4.7
Keywords: bibisected, difficultyBeginner, easyHack, haveBacktrace, perf, regression, skillCpp, topicCleanup
Depends on:
Blocks: Performance CPU-AT-100%
  Show dependency treegraph
 
Reported: 2020-06-19 19:26 UTC by Buovjaga
Modified: 2024-04-25 06:39 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Perf flamegraph (358.25 KB, image/svg+xml)
2020-06-19 19:26 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Buovjaga 2020-06-19 19:26:24 UTC
Created attachment 162215 [details]
Perf flamegraph

1. Open Writer
2. Insert an image
3. Right-click image, Edit with external tool

Watch the CPU go. It only stops, when you close the document.

Bibisected with Win 5.1 repo to a range of 5 commits due to an issue with full CPU use upon launching LibreOffice. The likely culprit among these is https://git.libreoffice.org/core/+/87199d3829257420429057336283c55be6ae7481%5E!/
vcl: re-introduce idle handling.

Adding Cc: to Michael Meeks
Comment 1 Telesto 2020-06-21 18:53:23 UTC
Yup
Version: 7.1.0.0.alpha0+ (x64)
Build ID: 43c60ce1ac7629a1462e927e6ff937469f58f743
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL

Perf graph is based on empty doc + image I assume.. for me it starting iterating text
Comment 2 Michael Meeks 2020-06-23 15:45:59 UTC
Well - the idle work is fine - we do fast idles, when we are idle. Of course if someone makes a busy loop using an idle handler that never completes - we hit 100% CPU. If they leak that busy idle handler then ... we get this effect.

I would go read the edit with external tool code, and work out why an idle handler is used there, and/or turn it into a 250ms timeout or so.

HTH =)
Comment 3 Michael Meeks 2020-06-23 16:04:34 UTC
Code pointer:

include/svtools/filechangedchecker.hxx:class UNLESS_MERGELIBS(SVT_DLLPUBLIC) FileChangedChecker
include/svtools/filechangedchecker.hxx-{
include/svtools/filechangedchecker.hxx-private:
include/svtools/filechangedchecker.hxx-    Idle                    mIdle;

Should be a timeout.
Comment 4 Commit Notification 2020-09-19 06:51:44 UTC
Tomofumi Yagi committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f110c037114f90d219ac8d149542bf96fe66a2f1

tdf#134157 fix Edit with external tool causes a CPU hit

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Buovjaga 2020-09-19 12:24:03 UTC
Thanks, Tomofumi, I verify the fix!

Arch Linux 64-bit
Version: 7.1.0.0.alpha0+
Build ID: 1f07c2e440326f2b2c8ffbb53c91570e6cfcd74d
CPU threads: 8; OS: Linux 5.8; UI render: default; VCL: kf5
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 19 September 2020
Comment 6 Commit Notification 2020-09-21 15:57:12 UTC
Tomofumi Yagi committed a patch related to this issue.
It has been pushed to "libreoffice-7-0":

https://git.libreoffice.org/core/commit/1d28170d94893171e2a358274cda62cd73f7b834

tdf#134157 fix Edit with external tool causes a CPU hit

It will be available in 7.0.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2020-09-22 06:41:05 UTC
Tomofumi Yagi committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/bd1345f9806b1bb9940d208d75610f7c4556f05d

tdf#134157 fix Edit with external tool causes a CPU hit

It will be available in 6.4.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2020-09-28 17:40:02 UTC
Tomofumi Yagi committed a patch related to this issue.
It has been pushed to "libreoffice-7-0-2":

https://git.libreoffice.org/core/commit/d62fe22aed6acf36c5321a417beb4c37a5f715a2

tdf#134157 fix Edit with external tool causes a CPU hit

It will be available in 7.0.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Buovjaga 2020-09-29 09:54:32 UTC
Tomofumi: feel free to change status to fixed.
Comment 10 Telesto 2020-10-05 17:40:52 UTC
(In reply to Buovjaga from comment #9)
> Tomofumi: feel free to change status to fixed.

Bump