Bug 461230 - 100% CPU loop on a system with bidirectional locale
Summary: 100% CPU loop on a system with bidirectional locale
Status: RESOLVED FIXED
Alias: None
Product: kasts
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: bart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-31 05:12 UTC by Tzafrir Cohen
Modified: 2022-12-12 19:55 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
The Episodes screen when Kasts is run in a Hebrew-language locale (47.66 KB, image/png)
2022-12-03 14:22 UTC, Tzafrir Cohen
Details
The Episodes screen when Kasts is run in an English-language locale (189.09 KB, image/png)
2022-12-03 14:24 UTC, Tzafrir Cohen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tzafrir Cohen 2022-10-31 05:12:43 UTC
I installed kasts 22.06   (stable) on a Mobian (Debian Unstable, gnome, wayland) system.

After a while, everything I did took ages, including closing the app. Basically the problem seems to start after I included the first podcast. I used one that has many episodes and the description is almost always in Hebrew (specifically: Geekonomy: https://feeds.podbean.com/geekonomy/feed.xml ).

Looking further, I saw that in the journal I keep getting the following message:

org.kde.kasts.desktop[5230]: <Unknown File>: QML QQuickAnchors: Binding loop detected for property "right"
org.kde.kasts.desktop[5230]: qml: Don't override the leftPadding or rightPadding on a SwipeListItem!
org.kde.kasts.desktop[5230]: This makes it impossible for me to adjust my layout as I need to for various usecases.
org.kde.kasts.desktop[5230]: I'll try to fix the mistake for you, but you should remove your overrides from your app's code entirely.
org.kde.kasts.desktop[5230]: If I can't fix the paddings, I'll fall back to a default layout, but it'll be slightly incorrect and lacks
org.kde.kasts.desktop[5230]: adaptations needed for touch screens and right-to-left languages, among other things.

(It's in a loop, so I'm not completely sure what is the first line)

I used the following workaround to fix the issue:

sudo mv /var/lib/flatpak/app/org.kde.kasts/aarch64/stable/$FLATPAK_HASH/files/bin/kasts{,.real}
cat <<EOF | tee -a /var/lib/flatpak/app/org.kde.kasts/aarch64/stable/$FLATPAK_HASH/files/bin/kasts
#!/bin/sh
export LANG=C
exec "$0.real" "$@"
EOF
sudo chmod +x /var/lib/flatpak/app/org.kde.kasts/aarch64/stable/$FLATPAK_HASH/files/bin/kasts

And with that, kasts now works fine.

The following values for LANG are problematic:
he_IL.UTF-8
ar_JO.UTF-8

The following values work OK:
C
en_IL.UTF-8


My locale is:
$ locale
LANG=he_IL.UTF-8
LANGUAGE=
LC_CTYPE="he_IL.UTF-8"
LC_NUMERIC="he_IL.UTF-8"
LC_TIME="he_IL.UTF-8"
LC_COLLATE="he_IL.UTF-8"
LC_MONETARY="he_IL.UTF-8"
LC_MESSAGES="he_IL.UTF-8"
LC_PAPER="he_IL.UTF-8"
LC_NAME="he_IL.UTF-8"
LC_ADDRESS="he_IL.UTF-8"
LC_TELEPHONE="he_IL.UTF-8"
LC_MEASUREMENT="he_IL.UTF-8"
LC_IDENTIFICATION="he_IL.UTF-8"
LC_ALL=

$ flatpak list
Name                         Application ID                 Version Branch     Installation
Mesa                         …eedesktop.Platform.GL.default 21.3.9  21.08      system
GNOME Application Platform … org.gnome.Platform                     42         system
Podcasts                     org.gnome.Podcasts             0.5.1   stable     system
Adwaita theme                org.kde.KStyle.Adwaita                 5.15-21.08 system
KDE Application Platform     org.kde.Platform                       5.15-21.08 system
Kasts                        org.kde.kasts                  22.06   stable     system
Comment 1 bart 2022-10-31 14:27:03 UTC
Thanks for reporting.

Actually, that RTL warning/error in the output is a bug of the Kirigami framework that Kasts is using for the GUI.  It's a false warning that's always triggered; it should be solved in the next Kirigami update.

But anyway, I agree that looking at your testing results, the problem *IS* actually related to RTL.  Unfortunately, I'm not really familiar with any RTL language, but I'll try to reproduce it and find the root cause.  The underlying frameworks should all support it, and I tried to layout the UI in such a way that it would still work with RTL.
Comment 2 bart 2022-11-16 09:21:17 UTC
I've been trying to reproduce this problem, but I can't on my system.  The only difference with your setup is that I'm using KDE  instead of gnome, but this should (theoretically) not have an impact on a flatpak package...

Could you perhaps provide more information, e.g. make a screen recording of exactly what is happening when the app becomes unresponsive?  Show the cpu/mem usage when that happens, etc.?
Comment 3 Bug Janitor Service 2022-12-01 05:14:00 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 Tzafrir Cohen 2022-12-03 14:21:09 UTC
I reproduced the issue on my laptop (Debian Unstable as well[1]).

On my laptop I use the local en_IL. What I have is:

# Good
rm -rf ~/.local/share/KDE/kasts/database.db3 ~/.cache/KDE/kasts
kasts -a https://www.omnycontent.com/d/playlist/23f697a0-7e6a-4e96-a223-a82c00962b12/304b2cf5-dea9-4263-8a33-a919008d5a41/a82055c0-d8eb-4780-b6bb-a919008d5a42/podcast.rss

# Bad
rm -rf ~/.local/share/KDE/kasts/database.db3 ~/.cache/KDE/kasts
LANGUAGE= LANG=he_IL.UTF8 kasts kasts -a https://www.omnycontent.com/d/playlist/23f697a0-7e6a-4e96-a223-a82c00962b12/304b2cf5-dea9-4263-8a33-a919008d5a41/a82055c0-d8eb-4780-b6bb-a919008d5a42/podcast.rss

"Bad" means: I can easily switch between the queue, search, subscription and downloads tabs. But when switching to and from the episodes tab, I get a huge CPU usage and some delay. On my phone it is more noticeable.

Furthermore, the episodes in the list are badly-placed: too much to the right.

BTW: On my laptop I use X11/i3wm (no KDE or gnome). 

[1] BTW: I added libqt5svg5-dev and kirigami2-dev to the list of required packages listed in the README)
Comment 5 Tzafrir Cohen 2022-12-03 14:22:59 UTC
Created attachment 154267 [details]
The Episodes screen when Kasts is run in a Hebrew-language locale
Comment 6 Tzafrir Cohen 2022-12-03 14:24:18 UTC
Created attachment 154268 [details]
The Episodes screen when Kasts is run in an English-language locale
Comment 7 bart 2022-12-05 08:32:03 UTC
Thanks for the additional info.  I'll do another attempt to reproduce.
Comment 8 bart 2022-12-05 12:04:00 UTC
Thanks for the extra info and the screenshots.  I can now finally reproduce the problem on my side.
Let's try and get this fixed now.
Comment 9 Bug Janitor Service 2022-12-11 17:01:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma-mobile/kasts/-/merge_requests/89
Comment 10 bart 2022-12-11 17:03:46 UTC
I think I've fixed this.
I don't know how comfortable you are with building from source.  If you are able to, you can try out this MR and check if it solves your issues.
https://invent.kde.org/plasma-mobile/kasts/-/merge_requests/89
Comment 11 Tzafrir Cohen 2022-12-12 18:49:51 UTC
The suggested patch seems to fix my issue. Thanks!
Comment 12 bart 2022-12-12 19:50:04 UTC
(In reply to Tzafrir Cohen from comment #11)
> The suggested patch seems to fix my issue. Thanks!

Thanks for confirming.  Let's merge this...
Comment 13 bart 2022-12-12 19:55:41 UTC
Git commit a07deae71d73e56c67e47fb3c9f01364ea741554 by Bart De Vries.
Committed on 12/12/2022 at 19:54.
Pushed by bdevries into branch 'master'.

Fix RTL layout bugs

M  +4    -1    src/qml/EpisodeListPage.qml
M  +4    -0    src/qml/FeedDetailsPage.qml
M  +4    -1    src/qml/FeedListPage.qml
M  +4    -1    src/qml/GenericEntryDelegate.qml
M  +4    -1    src/qml/QueuePage.qml

https://invent.kde.org/plasma-mobile/kasts/commit/a07deae71d73e56c67e47fb3c9f01364ea741554