https://bugs.kde.org/show_bug.cgi?id=521823

--- Comment #4 from Angel Parra <[email protected]> ---
Created attachment 194136
  --> https://bugs.kde.org/attachment.cgi?id=194136&action=edit
Perf report. Points to libpng/libgomp.

> 3. Can you verify you've got the `kimageformats` package installed? If you 
> don't, can you install it and try again?

It was already installed prior bug report.

> 1. Can you try the Flatpak version from Flathub and see if that works better?

After 20 tries, the Flatpak version did not freeze. I still can trigger the
freeze on the native version after 3 tries though.

> 2. Can you run `koko [path to affected image]` in a terminal window and paste 
> the log output?

Actually, I've run it through perf record and got a report that is pretty close
to my original hunch on some problem with PNG decoding.

As the report is pretty dense and I myself don't know how to read that wall of
text, this a short summary written by AI (I did not tell it what the freeze was
about when asking for the first explanation so no influence factor on this
one):

According to the `perf report`, the application freeze is characterized by
massive CPU utilization—accumulating approximately 3 million sampling
events—which isolates the bottleneck to an intensive computational loop rather
than a resource deadlock or network stall. The trace reveals that a staggering
91.20% of the CPU cycles are concentrated within OpenMP runtime synchronization
routines (`libgomp.so`) triggered during image operations. Specifically, the
processing degradation initiates when `koko` issues a synchronous image loading
request (`createPixmapDataSync`), which descends directly into the Qt image
sub-system (`QImageReader::read`).

The root cause of the interface starvation explicitly points to PNG decoding
operations managed via `libpng`. As the reader processes the image file,
internal color conversions and format adaptations (such as `png_read_image`,
`png_do_bgr`, and `mask_alpha_converter_inplace`) force Qt to evaluate pixel
attributes via `QImageData::checkForAlphaPixels`. This workload heavily invokes
OpenMP parallelism (`GOMP_parallel`), which saturates the CPU cores and starves
the main UI thread, explaining why the application exhibits severe freezing
behavior exclusively when handling heavy PNG assets."

And this is the output printed to the command line:

~/Documentos/programacion/Proyectos/stray/koko $ perf record -g build/bin/koko
/home/notangel/Imágenes/stasac-moresky.png
qt.core.qobject.connect: QObject::connect(QObject, QQmlDMObjectData): invalid
nullptr parameter
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
kf.kirigami.layouts: Could not create delegate for ToolBarLayout
kf.kirigami.layouts:
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/ActionToolBar.qml: Object or
context destroyed during incubation
file:///usr/lib/qt6/qml/org/kde/kirigami/controls/PageRow.qml:1004:9: QML
QQuickItem*: StackView has detected conflicting anchors. Transitions may not
execute properly.
kf.kio.core.connection: Socket not connected QLocalSocket::PeerClosedError
kf.kio.core: An error occurred during write. The worker terminates now.
kf.kio.core.connection: Socket not connected QLocalSocket::PeerClosedError
kf.kio.core: An error occurred during write. The worker terminates now.
^C[ perf record: Woken up 1345 times to write data ]
^[OM
[ perf record: Captured and wrote 342.160 MB perf.data (3426685 samples) ]

~/Documentos/programacion/Proyectos/stray/koko $

NOTE: the kf.kio.core prints happen even when koko itself is not being executed
and the prompt is already unlocked to type another command.

In fact, that is dirtying my prompt:

~/Documentos/programacion/Proyectos/stray/koko $ kf.kio.core.connection: Socket
not connected QLocalSocket::PeerClosedError
kf.kio.core: An error occurred during write. The worker terminates now.
kf.kio.core.connection: Socket not connected QLocalSocket::PeerClosedError
kf.kio.core: An error occurred during write. The worker terminates now.
kf.kio.core.connection: Socket not connected QLocalSocket::PeerClosedError
kf.kio.core: An error occurred during write. The worker terminates now.
kf.kio.core.connection: Socket not connected QLocalSocket::PeerClosedError
kf.kio.core: An error occurred during write. The worker terminates now.
clacc


Side note: this build of Koko is compiled without custom compilation flags:

~ $ cmake -B build -S . -G Ninja \                                      
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to