Bug 482800 - Kate hangs if the open sysfs file has been modified externally
Summary: Kate hangs if the open sysfs file has been modified externally
Status: CLOSED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 24.02.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: qt6, usability
Depends on:
Blocks:
 
Reported: 2024-03-08 01:50 UTC by Yevhen Popok
Modified: 2024-06-19 13:13 UTC (History)
1 user (show)

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


Attachments
GDB backtrace (85.55 KB, text/plain)
2024-06-17 13:09 UTC, Yevhen Popok
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yevhen Popok 2024-03-08 01:50:37 UTC
SUMMARY
Application freezes if user has opened file from the /sys directory, and this file was changed externally.
For example, user disables CPU core , changes I/O Disk scheduler or tweaks some device parameter
Freezing also occurs if the file contents are overwritten with the same value.

STEPS TO REPRODUCE
1. Open /sys/devices/system/cpu/cpu1/online using KWrite or Kate
2. Open terminal (either Kate built-in or external application)
3. Execute the command below to overwrite the file value
echo 1 | sudo tee /sys/devices/system/cpu/cpu1/online

OBSERVED RESULT
KWrite/Kate window freezes

EXPECTED RESULT
KWrite/Kate window shouldn't freeze

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:  Fedora Kinoite 40
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
If I modify file within Kate/KWrite, it can't be saved (even though I provide a correct password for administrator authentication). The error says that "The document could no be saved, as it was no possible to write to ...".  That's also the case with files inside /proc directory (e.g. /proc/sys/vm/page-cluster), though Kate doesn't freeze if those files are changed externally.
Comment 1 Nate Graham 2024-06-14 15:11:02 UTC
Migrating "reproducible" keyword to "CONFIRMED" status.
Comment 2 Christoph Cullmann 2024-06-16 19:22:49 UTC
Could you provide some backtrace where we are stuck or use perf to check in which function we are hanging around?
Comment 3 Yevhen Popok 2024-06-17 13:09:41 UTC
Created attachment 170567 [details]
GDB backtrace

(In reply to Christoph Cullmann from comment #2)
> Could you provide some backtrace where we are stuck or use perf to check in
> which function we are hanging around?

I added backtrace generated with GDB + debuginfod on KDE Neon Developer Edition.
Hope this helps.
Comment 4 Christoph Cullmann 2024-06-17 19:36:23 UTC
Git commit 59d5798b98c9aaea55fe7e38f697697241b8da80 by Christoph Cullmann.
Committed on 17/06/2024 at 19:36.
Pushed by cullmann into branch 'master'.

try different way to read file for digest

might be the old variant stalls on some virtual sys/proc files

M  +1    -5    src/document/katedocument.cpp

https://invent.kde.org/frameworks/ktexteditor/-/commit/59d5798b98c9aaea55fe7e38f697697241b8da80
Comment 5 Christoph Cullmann 2024-06-17 19:39:08 UTC
Hi, the info provided some hints.
Could you try out the patched version?
Comment 6 Yevhen Popok 2024-06-19 12:58:02 UTC
(In reply to Christoph Cullmann from comment #5)
> Hi, the info provided some hints.
> Could you try out the patched version?

This solved the problem. Thank you!
Comment 7 Christoph Cullmann 2024-06-19 13:13:13 UTC
(In reply to Yevhen Popok from comment #6)
> (In reply to Christoph Cullmann from comment #5)
> > Hi, the info provided some hints.
> > Could you try out the patched version?
> 
> This solved the problem. Thank you!

Great, thanks for helping out with the info, without that would have not found this.