Bug 128710 - Extension hangs under VCLPLUGIN=kf5
Summary: Extension hangs under VCLPLUGIN=kf5
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Extensions (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.5.0 target:6.4.0.1 target:6.3.4
Keywords:
Depends on:
Blocks: KDE, KF5
  Show dependency treegraph
 
Reported: 2019-11-11 12:11 UTC by Franklin Weng
Modified: 2020-04-26 05:01 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Extension file (22.54 KB, application/vnd.openofficeorg.extension)
2019-11-11 12:12 UTC, Franklin Weng
Details
bt with debug symbols (kf5) (8.36 KB, text/plain)
2019-11-11 16:52 UTC, Julien Nabet
Details
Extension file (Nov. 26) (39.78 KB, application/vnd.openofficeorg.extension)
2019-11-26 04:41 UTC, Franklin Weng
Details
ThemeChanger extension (Dec. 5) (39.77 KB, application/vnd.openofficeorg.extension)
2019-12-05 05:48 UTC, Franklin Weng
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Franklin Weng 2019-11-11 12:11:19 UTC
Description:
We're developing a LibreOffice extension using Python.  We've done a basic framework and it can be installed in LibreOffice.  However it only works when VCLPLUGIN=gtk3.  When using VCLPLUGIN=kf5, it would show nothing and would just hang there, accepting no input anymore.

The extension code is at:
https://github.com/libreofficeid/LO-TC-GUI

and the extension oxt file will be attached later.


Steps to Reproduce:
1. Install the oxt file built by the code providing above.
2. In Tools->Addons, run the extension
3. Nothing will be shown and the whole LibreOffice would be stuck there

Actual Results:
Nothing will be shown and the whole LibreOffice would be stuck there

Expected Results:
It should show a dialog named Theme Changer.


Reproducible: Always


User Profile Reset: No



Additional Info:
My LibreOffice version is:
版本:6.4.0.0.alpha1
組建 ID:cc57df8f942f239d29cb575ea5a7cb01405db787
CPU 執行緒:4; OS:Linux 5.2; UI 算繪:預設; VCL: kf5; 
語言地區:zh-TW (zh_TW.UTF-8); UI-Language: zh-TW
Calc: threaded
Comment 1 Franklin Weng 2019-11-11 12:12:00 UTC
Created attachment 155701 [details]
Extension file
Comment 2 Julien Nabet 2019-11-11 16:52:15 UTC
Created attachment 155710 [details]
bt with debug symbols (kf5)

On pc Debian x86-64 with master sources updated today, I don't reproduce the crash at this moment but when closing LO (with kf5 + gen, not with gtk3)
Comment 3 Buovjaga 2019-11-11 20:50:04 UTC
I repro the stuckness.

Arch Linux 64-bit
Version: 6.4.0.0.alpha1+
Build ID: 24f17f0336badfbba276c1e6713a89b4f9bb7cb8
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 11 November 2019
Comment 4 Jan-Marek Glogowski 2019-11-14 12:24:10 UTC
(In reply to Julien Nabet from comment #2)
> Created attachment 155710 [details]
> bt with debug symbols (kf5)
> 
> On pc Debian x86-64 with master sources updated today, I don't reproduce the
> crash at this moment but when closing LO (with kf5 + gen, not with gtk3)

Please open a new bug report. This is about an extension dead- or life-locking LO in the kf5 and gen backend. Your bug is some broken VclPtr handling, which triggers an assertion in debug builds.
Comment 5 Jan-Marek Glogowski 2019-11-15 00:31:58 UTC
This is basically a duplicate of bug 121293. That bug was "fixed" by adapting the presentation minimizer extension, so it won't trigger the "Show, Hide, SetModal, Show" code path. Easily done, as the setVisible(True), before the execute() in the showDialog() python call in the extension, is not needed. The original, but later removed workaround (to sleep 250ms after the Hide in SetModal) also still works (that was commit e770bacc85a0eec96de77068d61b03f374b3cdec). I couldn't find and fix the real bug back then.

The underlying problem is the non-mapped modal main window of the extension, which blocks LO, even if it's invisible (you can see the unmapped window state of it with "xwininfo -name MainDialog", if you're curious).

So I wasn't very optimistic after finding all this, but OTOH this is like fresh start on an old bug and I had a very crude workaround at hand, if all failed. So now I'm even more happy to present a non-workaround fix: https://gerrit.libreoffice.org/82745

And BTW: while looking into bug 121293 I found a resource leak in the minimizer, which also affect your extension. If you call xDialog->createPeer(xToolkit, ...), you need to explicitly free that resource later by calling the equivalent of

Reference<XComponent> xDialogComponent(xDialog, UNO_QUERY_THROW);
xDialogComponent->dispose();

probably in the python __exit__ function of your dialog.

You can see the leak by calling "xwininfo -root -tree | grep children" after opening and closing your dialog. You'll see the number of children growing +1 per opened and closed dialog. This is actually documented somewhere in the OOo UNO dialog development wiki pages, but still it took me quite some time to understand the origin of that leakage back then.
Comment 6 Buovjaga 2019-11-15 11:57:23 UTC
(In reply to Jan-Marek Glogowski from comment #5)
> So I wasn't very optimistic after finding all this, but OTOH this is like
> fresh start on an old bug and I had a very crude workaround at hand, if all
> failed. So now I'm even more happy to present a non-workaround fix:
> https://gerrit.libreoffice.org/82745

Built with the patch and stuckness is gone. Thanks!
Comment 7 Commit Notification 2019-11-15 15:46:42 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5d23f7748f33414a95297fa9f374a37e76de687b

tdf#128710 Qt5 don't force immediate paint on show

It will be available in 6.5.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 8 Jan-Marek Glogowski 2019-11-15 15:49:02 UTC
Set VERIFIED FIXED from comment 6. Backports are on their way.
Comment 9 Commit Notification 2019-11-15 21:38:08 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/876303943113bb7fa09c3b344a832f714ac2d8e3

tdf#128710 Qt5 don't force immediate paint on show

It will be available in 6.4.0.1.

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 10 Commit Notification 2019-11-19 17:04:47 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/commit/02c056b071f95257bd09b7fdfa479bff97bc33dc

tdf#128710 Qt5 don't force immediate paint on show

It will be available in 6.3.4.

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 11 Franklin Weng 2019-11-26 04:41:41 UTC
Created attachment 156116 [details]
Extension file (Nov. 26)

Test under:

Version: 6.4.0.0.beta1
Build ID: 4d7e5b0c40ed843384704eca3ce21981d4e98920
CPU threads: 4; OS: Linux 5.3; UI render: default; VCL: kf5; 
Locale: zh-TW (zh_TW.UTF-8); UI-Language: en-US
Calc: threaded


The extension can be shown, but would still hang randomly.  Sometimes it would hang when launching; sometimes hang when clicking a button like Create or Import.

When hanging I can still move and change the window size, just nothing happens when clicking on any button, even the window closing x button.
Comment 12 Franklin Weng 2019-11-26 04:42:59 UTC
(In reply to Franklin Weng from comment #11)
> Created attachment 156116 [details]
> Extension file (Nov. 26)
> 
> Test under:
> 
> Version: 6.4.0.0.beta1
> Build ID: 4d7e5b0c40ed843384704eca3ce21981d4e98920
> CPU threads: 4; OS: Linux 5.3; UI render: default; VCL: kf5; 
> Locale: zh-TW (zh_TW.UTF-8); UI-Language: en-US
> Calc: threaded
> 
> 
> The extension can be shown, but would still hang randomly.  Sometimes it
> would hang when launching; sometimes hang when clicking a button like Create
> or Import.
> 
> When hanging I can still move and change the window size, just nothing
> happens when clicking on any button, even the window closing x button.

And again, everything is okay under VCLPLUGIN=gtk3
Comment 13 Buovjaga 2019-11-27 18:52:32 UTC
(In reply to Franklin Weng from comment #11)
> Created attachment 156116 [details]
> Extension file (Nov. 26)
> 
> Test under:
> 
> Version: 6.4.0.0.beta1
> Build ID: 4d7e5b0c40ed843384704eca3ce21981d4e98920
> CPU threads: 4; OS: Linux 5.3; UI render: default; VCL: kf5; 
> Locale: zh-TW (zh_TW.UTF-8); UI-Language: en-US
> Calc: threaded
> 
> 
> The extension can be shown, but would still hang randomly.  Sometimes it
> would hang when launching; sometimes hang when clicking a button like Create
> or Import.
> 
> When hanging I can still move and change the window size, just nothing
> happens when clicking on any button, even the window closing x button.

I installed the new extension, but no hang for me

Arch Linux 64-bit
Version: 6.5.0.0.alpha0+
Build ID: 5f0db2c24c466e3c4cf0dc8faba1c62b38c770fd
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 27 November 2019
Comment 14 Franklin Weng 2019-12-05 05:48:57 UTC
Created attachment 156320 [details]
ThemeChanger extension (Dec. 5)

It still happen randomly.  Click create, cancel, import, cancel, try import themes located in git repository, ... it would eventually hangs.
Comment 15 Michael Weghorn 2020-04-21 12:55:37 UTC
Is this still reproducible with a current daily build of master?

(In reply to Franklin Weng from comment #14)
> It still happen randomly.  Click create, cancel, import, cancel, try import
> themes located in git repository, ... it would eventually hangs.

To narrow this down a bit: Can you reduce the amount of different steps taken, e.g. does it also happen if you just click "Create" and "Cancel" one after the other all of the time?
Comment 16 Franklin Weng 2020-04-26 05:01:02 UTC
(In reply to Michael Weghorn from comment #15)
> Is this still reproducible with a current daily build of master?
> 
> (In reply to Franklin Weng from comment #14)
> > It still happen randomly.  Click create, cancel, import, cancel, try import
> > themes located in git repository, ... it would eventually hangs.
> 
> To narrow this down a bit: Can you reduce the amount of different steps
> taken, e.g. does it also happen if you just click "Create" and "Cancel" one
> after the other all of the time?

Not reproducible in

版本:6.4.3.2
組建 ID:747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
CPU 執行緒:4; OS:Linux 5.4; UI 算繪:預設; VCL: kf5; 
語言地區:zh-TW (zh_TW.UTF-8); 介面語言:zh-TW
Calc: threaded

Set to WORKSFORME.