Linux: FreeFileSync using GTK3 on KDE is hanging

Get help for specific problems
Posts: 5
Joined: 21 Feb 2023

drak

Hi,

Love FFS. The Donation edition broke on me after today's update.
Clicking any buttons or trying to open FFS preferences leads to a full freeze of the app, and requires xkilling.

System Plasma 5.27.0
Kernel: 5.19.0-32-generic

I installed free flatpak version, and rejected the update, and managed to sync that way but would appreciate being faster ;)

Cheers thanks, all the best
Posts: 4
Joined: 21 Feb 2023

Crustyman

I have the same problem, +1. Just freezes.

System: endeavoros
DE: KDE plasma 5.27.1
Kernel: 6.1.12
gtk3 version: 3.24.36-1
Posts: 12
Joined: 13 Oct 2018

fefisy

+1

Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.3
Kernel Version: 5.15.0-60-generic (64-bit)

libgtk-3.0 version 3.24.33-1ubuntu2
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

This is due to the switch to GTK3 and seems to affect KDE only.

Let's test something. Are the hangs reproducible if you start FreeFileSync via command line as
GDK_SYNCHRONIZE=1 FreeFileSync
?
Posts: 4
Joined: 21 Feb 2023

Crustyman

Yes, nothing changes
Posts: 44
Joined: 14 Aug 2022

daviank

It seems I have a similar problem on debian with KDE, when built from source.
BTW, the Makefile still references gtk2, is this as expected or should it be gtk3 now?
Posts: 12
Joined: 13 Oct 2018

fefisy

This is due to the switch to GTK3 and seems to affect KDE only.

Let's test something. Are the hangs reproducible if you start FreeFileSync via command line as
GDK_SYNCHRONIZE=1 FreeFileSync
? Zenju, 22 Feb 2023, 08:25
This worked for me as expected. No hangs.
However, also got this:
(FreeFileSync_x86_64:246593): Gtk-CRITICAL **: 17:29:57.211: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
Posts: 12
Joined: 13 Oct 2018

fefisy

This worked for me as expected. No hangs.
However, also got this:
(FreeFileSync_x86_64:246593): Gtk-CRITICAL **: 17:29:57.211: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
fefisy, 22 Feb 2023, 22:36
Update: When launched from FreeFileSync.desktop containing the following...
Exec=GDK_SYNCHRONIZE=1 "/opt/FreeFileSync/FreeFileSync" %F
...I was able to perform several sync actions without hangs, but not consistently. The application still hangs intermittently and has to be killed and restarted.
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

I've reverted FFS back to GTK2 until this issue has been sorted out.

FFS does a peculiar little dance during modal dialog initialization:
    GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize()
#ifdef __WXGTK3__
    Show(); //GTK3 size calculation requires visible window: https://github.com/wxWidgets/wxWidgets/issues/16088
    Hide(); //avoid old position flash when Center() moves window (asynchronously?)
#endif
    Center(); //needs to be re-applied after a dialog size change!
I suspect the Show/Hide pair is triggering the hang, which is most likely nothing more than a hidden modal dialog.

Perhaps someone has an idea why FFS hangs on GTK3 and KDE? Or knows a better way to coerce GTK3 to set correct window sizes?
Posts: 5
Joined: 21 Feb 2023

drak

Just saw the update and tried it, it successfully opened one dialog but then froze after trying to open a second one. I wish I knew how to be more helpful :')

I can cheer ;)
Posts: 12
Joined: 13 Oct 2018

fefisy

I've reverted FFS back to GTK2 until this issue has been sorted out. Zenju, 24 Feb 2023, 18:09
Is this going to be available for download/installation, or should I download and install 12.0?
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

The official FFS 12.1 has been replaced with the GTK2 build again.
Posts: 5
Joined: 21 Feb 2023

drak

My installation that auto-updated to the problematic version, is not notifying of an update to pull the GTK2 build. Please, thank you.
Posts: 12
Joined: 13 Oct 2018

fefisy

My installation that auto-updated to the problematic version, is not notifying of an update to pull the GTK2 build. Please, thank you. drak, 07 Mar 2023, 16:44
Manually download and install using NON-donation 12.1 installer. I found that the donation edition has gtk3.
Posts: 44
Joined: 14 Aug 2022

daviank

Zenju, reverting the change you mention apparently removes the issue (still built with GTK3).

For anyone interested, a patch for this revert is available here: https://salsa.debian.org/bastif/freefilesync/-/blob/debian/latest/debian/patches/revert_buggy_gtk3_change_in_12.1.patch
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Manually download and install using NON-donation 12.1 installer. I found that the donation edition has gtk3. fefisy, 07 Mar 2023, 17:47
How did you determine that? The build should be GTK2-based.
Posts: 5
Joined: 21 Feb 2023

drak

I haven't tried redownloading the donation version. Let me know if that's best Zenju, thank you for keeping up with this I really appreciate it.
EDIT: Missed the patch somehow, don't know how to apply it though, thanks for the help in advance
Posts: 5
Joined: 21 Feb 2023

drak

Can someone please tell me exactly how to apply this patch? Thank you so much.
Posts: 12
Joined: 13 Oct 2018

fefisy

Manually download and install using NON-donation 12.1 installer. I found that the donation edition has gtk3. fefisy, 07 Mar 2023, 17:47
How did you determine that? The build should be GTK2-based. Zenju, 07 Mar 2023, 18:44
Well, this is what I saw:
1. Downloaded 12.1 donation edition installer when I first saw the update notification. After installing this, I saw the GTK3 issue reported in this thread.
2. Upon learning that 12.1 was rolled back to GTK2, I downloaded the donation edition installer again and re-installed. I continued to see the GTK3 issue.
3. I then downloaded and ran the non-donation 12.1 installer. Now I don't see the GTK3 issue.
Posts: 44
Joined: 14 Aug 2022

daviank

Dear Zenju, I have been investigating this a bit since I run on KDE, which caused trouble with gtk3 at the time of 12.1.

Actually, I found that calling only Show() but not Hide() as code currently does since 12.1:
- doesn't create the "freeze/hang" on KDE that appeared in 12.1
- fixes the size of the dialogs (see screenshots)
- there is no flickering on screen

However, I can't test this on other desktop environments like Gnome or any other because I run KDE.

Would that be an acceptable solution for that problem? Do you think this could be integrated in your sources?

The old way (ie. the GTK2 way built with GTK3 (=like the patch I put earlier in this thread))
Screenshot_20240206_225342.png
Screenshot_20240206_225342.png (4.59 KiB) Viewed 1173 times
The new way (ie. with the "patch" attached in this post)
Screenshot_20240206_224208.png
Screenshot_20240206_224208.png (5.17 KiB) Viewed 1173 times
The patch (it has .txt extension, but it should have .patch)
fix-gtk3-kde-hang.txt
(9.25 KiB) Downloaded 534 times
User avatar
Site Admin
Posts: 7212
Joined: 9 Dec 2007

Zenju

Dear Zenju, I have been investigating this a bit since I run on KDE, which caused trouble with gtk3 at the time of 12.1.

Actually, I found that calling only Show() but not Hide() as code currently does since 12.1:
- doesn't create the "freeze/hang" on KDE that appeared in 12.1
- fixes the size of the dialogs (see screenshots)
- there is no flickering on screen daviank, 06 Feb 2024, 22:05
I've commented out the Hide()s. This seems to fix the "hangs" on KDE, which are nothing more than the windows staying hidden after a "Hide(); Show()" sequence. GTK3 with all its asynchronicity seems to be responsible for this mess.
GDK_SYNCHRONIZE=1 seems to mitigate this issue by about 80%, but it's still reproducible!

Drawback: Without the "Hide()" the old position flashes shortly before "Center" on Gnome, which looks really ugly. GTK3, unfortunately is still not ready for prime time.
Posts: 44
Joined: 14 Aug 2022

daviank

BTW, I noticed that in the About dialog, only the last Show() must be kept. Having both leads to corruption in the dialog (at the location of the donation text + image)