Download it now!
Bug 129915 - gtk3: Calc freezes (slow performance and high CPU usage) with column selection
Summary: gtk3: Calc freezes (slow performance and high CPU usage) with column selection
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.3.4.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: perf
Depends on:
Blocks: GTK3
  Show dependency treegraph
 
Reported: 2020-01-10 07:29 UTC by Kevin Suo
Modified: 2020-03-03 13:51 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Test ods file (167.15 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-01-10 07:30 UTC, Kevin Suo
Details
perf flamegraph svg (235.52 KB, image/svg+xml)
2020-01-12 02:34 UTC, Kevin Suo
Details
perf flamegraph svg (566.77 KB, application/zip)
2020-01-13 23:42 UTC, Kevin Suo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2020-01-10 07:29:38 UTC
Description:
Selecting columns in a spreadsheet is very slow with very high CPU usage.

Steps to Reproduce:
1. Open the attached test ods file.
2. Select the entire columns A:C (i.e., click on the column header A and drop until header C).
3. Click any cell to release the selection 
4. Repeate step 2 and 3 several times.

Actual Results:
Calc freezes with 100% CPU usage of one core, and takes a long time for the selection to complete.

Expected Results:
The selection should complete within 3 seconds.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.3.4.2
Build ID: 60da17e045e08f1793c57c00ba83cdfce946d0aa
CPU 线程: 4; 操作系统: Linux 5.0; UI 渲染: 默认; VCL: gtk3; 
区域语言: zh-CN (zh_CN.UTF-8); UI 语言: zh-CN
Calc: threaded
Comment 1 Kevin Suo 2020-01-10 07:30:20 UTC
Created attachment 157049 [details]
Test ods file
Comment 2 Telesto 2020-01-10 18:15:51 UTC
No repro on Windows with
Version: 6.5.0.0.alpha0+ (x64)
Build ID: 42a1a1c6b91907f81e15066ffab219411f18c4db
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: GL; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL
Comment 3 Roman Kuznetsov 2020-01-11 08:59:45 UTC
no repro in

Версия: 6.4.0.2
ID сборки: 08d19fecdc7a2298d051e19cfdb7c35544855fc3
Потоков ЦП: 4; ОС: Mac OS X 10.15.2; Отрисовка ИП: по умолчанию; VCL: osx; 
Локаль: ru-RU (ru_RU.UTF-8); Язык интерфейса: ru-RU
Calc: threaded

possibly it's GTK3 only?

Kevin, can you test it:

1. with more new 6.4.0.2 version from TDF site?
2. on your machine but with vcl:gen instead gtk3? (use command SAL_USE_VCLPLUGIN=gen soffice)
Comment 4 Kevin Suo 2020-01-11 11:36:53 UTC
(In reply to Roman Kuznetsov from comment #3)

Yes, it is gtk3 only. If I set SAL_USE_VCLPLUGIN to gen or gtk, it works OK.
Comment 5 Buovjaga 2020-01-11 12:28:09 UTC
Could not repro with 6.3.4 or master with gtk3. Can you repro with a master build?

Arch Linux 64-bit
Version: 6.5.0.0.alpha0+
Build ID: a7afbbb86d4bb107dfbb24604c46ed9352bcb425
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 7 January 2020
Comment 6 Julien Nabet 2020-01-11 13:17:43 UTC
On pc Debian x86-64 with LO Debian package 6.3.4 + gtk3, I don't reproduce this.

When you indicate "several times", you mean about 5, 10, 20, more?
(I tried about 5 times)
Comment 7 Kevin Suo 2020-01-11 13:21:24 UTC
(In reply to Julien Nabet from comment #6)

For me, I noticed the slowness with just 2 or 3 times of repeat.
I am building master with --enable-symbols and trying to generate a perf blamegraph.
Comment 8 Kevin Suo 2020-01-12 02:34:54 UTC
Created attachment 157082 [details]
perf flamegraph svg

I am not sure whether the attached perf flamegraph is useful. It is generated using an --enable-symbols build on master branch, but the part consuming most of the CPU is marked as "[unknown]".

If further debug process is needed, please let me know.
Comment 9 Kevin Suo 2020-01-12 02:40:41 UTC
I share the perf.data file in the following link, in case someone need it:
https://home.suokunlong.cn/nextcloud/index.php/s/8SX7j3aHNFYeb9D
Comment 10 Julien Nabet 2020-01-12 09:34:02 UTC
Kevin: I don't know if it'll help or not.
It's a bit weird nobody can reproduce this except it it's related to localization.
Just to be sure, did you try with a brand new profile?
(see https://wiki.documentfoundation.org/UserProfile#GNU.2FLinux)

For Flamegraph, I've been told to use enable-symbols but without enable-dbgutil/enable-debug because these last options are a bit parasite for a Flamegraph.
For the rest, if you followed https://wiki.documentfoundation.org/Development/How_to_debug#Performance_debugging_.28perf.29, it should be ok.
Comment 11 Kevin Suo 2020-01-12 09:44:44 UTC
(In reply to Julien Nabet from comment #10)
Yes, I tried resetting the profile, but bug remains.

By the way, I am using a most recent version of Ubuntu 18.04 x64.
$ uname -a
Linux Kevin-X230i 5.0.0-37-generic #40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I don't see any of you mentioned Ubuntu who does not reproduce. It may be specific to Ubuntu 18.04 LTS.

I did setting the UI language to English U.S.
Comment 12 Julien Nabet 2020-01-12 10:19:01 UTC
(In reply to Kevin Suo from comment #11)
> (In reply to Julien Nabet from comment #10)
> Yes, I tried resetting the profile, but bug remains.
Ok
> ...
> I don't see any of you mentioned Ubuntu who does not reproduce. It may be
> specific to Ubuntu 18.04 LTS.
Maybe

> I did setting the UI language to English U.S.
Ok so not localization related.

Noel: any thoughts about Flamegraph attached by Kevin?
Comment 13 Kevin Suo 2020-01-12 11:15:54 UTC
As suggested in the ubuntu irc channel, I reported this issue to ubuntu bug tracker using ubuntu-bug, which contains more information about the system.
Comment 14 Julien Nabet 2020-01-12 14:19:42 UTC
(In reply to Kevin Suo from comment #13)
> As suggested in the ubuntu irc channel, I reported this issue to ubuntu bug
> tracker using ubuntu-bug, which contains more information about the system.

Just for curiosity, is it mandatory you stick with LTS? I mean, it can be related to gtk libs of this Ubuntu version.

Could you give a try with another rendering?
export SAL_USE_VCLPLUGIN=gen && soffice

or (if you have qt libs installed)
export SAL_USE_VCLPLUGIN=kf5 && soffice

Finally, would you have another computer to test with a recent Ubuntu?
Comment 15 Noel Grandin 2020-01-12 16:23:36 UTC
The perf graph is not useful, it has incomplete stacks. Perf needs to be configured with larger buffers to catch anything useful with libreoffice.

See the command line right at the end of this page:
https://wiki.documentfoundation.org/Development/How_to_debug#Performance_debugging_.28perf.29

and maybe install the gtk debug package to get good symbol names there
Comment 16 Xisco Faulí 2020-01-13 14:36:37 UTC
i set the perf chart to obsolete.
@Kevin, could you please provide a new one based on Noel's comment ?
Comment 17 Kevin Suo 2020-01-13 23:42:47 UTC
Created attachment 157134 [details]
perf flamegraph svg

See attached updated perf flamegraph svg with the following command:
perf record --call-graph dwarf,65528 --pid=`pidof soffice.bin`

The raw perf data file was 8GB in size, I terminated soffice by hitting ctrl+c once. I got the warning "Check IO/CPU overload!" when running the perf process.

I am not able to install the gtk3 debug package because it seems Ubuntu 18.04 does not provide one.
Comment 18 Noel Grandin 2020-02-01 07:31:28 UTC
Thanks for the flamegraph Kevin, that looks good. Unfortunately I dont see znything obviously easy to fix.
Comment 19 Noel Grandin 2020-03-02 13:37:00 UTC
I'm sorry, I can't reproduce this, so can't really fix it.
Presumably it has something to do with being in the right locale?
Comment 20 Kevin Suo 2020-03-02 14:14:49 UTC
(In reply to Noel Grandin from comment #19)
I am not sure whether is specific to any locale.

I will try to setup a (minimum) virtual machine in which this issue can be reproduced, does it help? If yes, I think the main problem is that the VM may be many GB to share to share.
Comment 21 Buovjaga 2020-03-02 14:27:45 UTC
Kevin: can you reproduce this with English UI and locale as well?

I tried with zh-CN locale (not UI yet) and I also installed Noto Sans CJK SC font as it was used in all the empty cells. I still could not reproduce the problem on Linux with gtk3, master build of my own.
Comment 22 Kevin Suo 2020-03-03 13:19:03 UTC
Well, I am not able to reproduce this in any of the virtual machines any more. I upgraded my host system from Ubuntu 18.04 to Fedora 31, this did not happen in Fedora, and also Ubuntu is going to release the Ubuntu 20.04 LTS very soon, so I'd rather close this as WORKSFORME.

However, when testing this bug, I found another one, which may be related, but may be a different issue. I reported in bug 131092. That one seems to be not specific to any locale or UI language.
Comment 23 Noel Grandin 2020-03-03 13:51:42 UTC
thanks Kevin