Bug 103313 - Print dialog maxes out CPU core to 100% when print comments enabled
Summary: Print dialog maxes out CPU core to 100% when print comments enabled
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
5.1.5.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.4.0 target:5.3.0.1 target:5.2.5
Keywords: bibisected, bisected, perf, regression
Depends on:
Blocks: Print-Dialog VCL-Scheduler Performance CPU-AT-100%
  Show dependency treegraph
 
Reported: 2016-10-18 12:50 UTC by Yousuf Philips (jay) (retired)
Modified: 2024-04-25 06:39 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2016-10-18 12:50:07 UTC
Steps:
1) Open a document with comments
2) Open print dialog
3) Change the value of the comments drop down list
4) One cpu core maxes out at 100%
5) Change the value back to None wont change this

Regression as this doesnt happen in 5.0.

Version: 5.3.0.0.alpha0+
Build ID: 45a7137c6796f33fbf5b8f7cb64e293260d991cb
CPU Threads: 2; OS Version: Linux 3.19; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-10-13_23:38:06
Locale: en-US (en_US.UTF-8); Calc: group
Comment 1 Michael Meeks 2016-10-22 12:04:30 UTC
Interesting; so this just exposes a previous busy-loop here - we can slow down layout with a timer and hurt our race-to-idle ;-) or we can identify and fix it =) the idle handler is:

Thread 1 "soffice.bin" hit Breakpoint 1, sw::DocumentTimerManager::DoIdleJobs (this=0x671edf0, pIdle=0x671ee08) at /data/opt/libreoffice/master/sw/source/core/doc/DocumentTimerManager.cxx:90
90          SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
(gdb) c
Continuing.

Thread 1 "soffice.bin" hit Breakpoint 2, sw::DocumentTimerManager::DoIdleJobs (this=0x671edf0, pIdle=0x671ee08) at /data/opt/libreoffice/master/sw/source/core/doc/DocumentTimerManager.cxx:123
123                     pIdle->Start();
(gdb) c
Continuing.

Thread 1 "soffice.bin" hit Breakpoint 1, sw::DocumentTimerManager::DoIdleJobs (this=0x671edf0, pIdle=0x671ee08) at /data/opt/libreoffice/master/sw/source/core/doc/DocumentTimerManager.cxx:90
90          SwRootFrame* pTmpRoot = m_rDoc.getIDocumentLayoutAccess().GetCurrentLayout();
(gdb) c
Continuing.

Thread 1 "soffice.bin" hit Breakpoint 2, sw::DocumentTimerManager::DoIdleJobs (this=0x671edf0, pIdle=0x671ee08) at /data/opt/libreoffice/master/sw/source/core/doc/DocumentTimerManager.cxx:123
123                     pIdle->Start();

It seems that we are repeatedly doing layout when comments are enabled from this longer trace:

#3  0x00007f255f5d7b9e in SwDoc::GetAllLayouts() (this=0x5dc4c90) at /data/opt/libreoffice/master/sw/source/core/doc/doclay.cxx:1649
#4  0x00007f255f65d897 in sw::DocumentTimerManager::DoIdleJobs(Idle*) (this=0x671edf0, pIdle=0x671ee08) at /data/opt/libreoffice/master/sw/source/core/doc/DocumentTimerManager.cxx:114
#5  0x00007f255f65d62d in sw::DocumentTimerManager::LinkStubDoIdleJobs(void*, Idle*) (instance=0x671edf0, data=0x671ee08) at /data/opt/libreoffice/master/sw/source/core/doc/DocumentTimerManager.cxx:82

#6  0x00007f258fe210c1 in Link<Idle*, void>::Call(Idle*) const (this=0x671ee28, data=0x671ee08) at /data/opt/libreoffice/master/include/tools/link.hxx:84
#7  0x00007f25903ae33f in Idle::Invoke() (this=0x671ee08) at /data/opt/libreoffice/master/vcl/source/app/idle.cxx:25
#8  0x00007f25903b0b53 in ImplSchedulerData::Invoke() (this=0x5e80730) at /data/opt/libreoffice/master/vcl/source/app/scheduler.cxx:47
#9  0x00007f25903b0f83 in Scheduler::ProcessTaskScheduling(bool) (bTimerOnly=false) at /data/opt/libreoffice/master/vcl/source/app/scheduler.cxx:184
#10 0x00007f25903d4029 in ImplYield(bool, bool, unsigned long) (i_bWait=false, i_bAllEvents=false, nReleased=0) at /data/opt/libreoffice/master/vcl/source/app/svapp.cxx:518
#11 0x00007f25903d0328 in Application::Yield() () at /data/opt/libreoffice/master/vcl/source/app/svapp.cxx:551
#12 0x00007f258feb46d9 in Dialog::Execute() (this=0x5d34460) at /data/opt/libreoffice/master/vcl/source/window/dialog.cxx:912
#13 0x00007f2590306c29 in Printer::PreparePrintJob(std::shared_ptr<vcl::PrinterController>, JobSetup const&) (xController=..., i_rInitSetup=...) at /data/opt/libreoffice/master/vcl/source/gdi/print3.cxx:473
#14 0x00007f2590307411 in Printer::ImplPrintJob(std::shared_ptr<vcl::PrinterController> const&, JobSetup const&) (xController=..., i_rInitSetup=...) at /data/opt/libreoffice/master/vcl/source/gdi/print3.cxx:523
#15 0x00007f2590305b97 in PrintJobAsync::ExecJob(void*) (this=0x5cea870) at /data/opt/libreoffice/master/vcl/source/gdi/print3.cxx:274
#16 0x00007f2590305b6d in PrintJobAsync::LinkStubExecJob(void*, void*) (instance=0x5cea870, data=0x0) at /data/opt/libreoffice/master/vcl/source/gdi/print3.cxx:272
#17 0x00007f258fffb8f9 in Link<void*, void>::Call(void*) const (this=0x5cea8a8, data=0x0) at /data/opt/libreoffice/master/include/tools/link.hxx:84
#18 0x00007f258fff8dc7 in ImplHandleUserEvent(ImplSVEvent*) (pSVEvent=0x5cea8a0) at /data/opt/libreoffice/master/vcl/source/window/winproc.cxx:1946
#19 0x00007f258fffa411 in ImplWindowFrameProc(vcl::Window*, SalEvent, void const*) (_pWindow=0x34ea140, nEvent=SalEvent::UserEvent, pEvent=0x5cea8a0) at /data/opt/libreoffice/master/vcl/source/window/winproc.cxx:2496
#20 0x00007f25905193bb in SalFrame::CallCallback(SalEvent, void const*) const (this=0x34ea8c0, nEvent=SalEvent::UserEvent, pEvent=0x5cea8a0) at /data/opt/libreoffice/master/vcl/inc/salframe.hxx:280

Caolan - I guess you're the expert here =)
Comment 2 raal 2016-10-25 17:24:24 UTC
This seems to have begun at the below commit.
 564a31a6903a2ae896058e5509236ccdc91062a3 is the first bad commit
commit 564a31a6903a2ae896058e5509236ccdc91062a3
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Tue Nov 24 21:51:11 2015 -0800

    source 87199d3829257420429057336283c55be6ae7481

	author	Michael Meeks <michael.meeks@collabora.com>	2015-11-24 16:59:29 (GMT)
committer	Michael Meeks <michael.meeks@collabora.com>	2015-11-24 19:46:02 (GMT)
commit 87199d3829257420429057336283c55be6ae7481 (patch)
tree 40f63144f9b20cebbaa6cb6fd64184e27c7b192f
parent 9b52b8999be86e5c6e5f5901b2640b16f08a2323 (diff)
vcl: re-introduce idle handling.
Comment 3 Caolán McNamara 2016-11-15 10:26:52 UTC
https://gerrit.libreoffice.org/#/c/30864/ is my effort which fixes this. I think the postit layout is sort of "manually" done and is outside the usual layout control but the existence of the "dirty" postit layout constantly blocks the idles attempt to complete. I don't see any ill effects of my effort in basic testing, maybe mstahl will know more about it
Comment 4 Commit Notification 2016-11-30 21:15:50 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=3690218b1f5073db8407a58f1b45a97d3d6fe7cd

Resolves: tdf#103313 idles never get to complete postit shell formatting

It will be available in 5.4.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 5 Commit Notification 2016-12-01 16:56:54 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=ceab440bf2bb4d414e5bac65c385167901d5a983&h=libreoffice-5-3

Resolves: tdf#103313 idles never get to complete postit shell formatting

It will be available in 5.3.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 6 Commit Notification 2016-12-08 15:34:38 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=509603e3763d064ec7951e7aa7978462ab6be458&h=libreoffice-5-2

Resolves: tdf#103313 idles never get to complete postit shell formatting

It will be available in 5.2.5.

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.