Bug 456710 - Crash when opening a kvtml file (The file is locked by another process)
Summary: Crash when opening a kvtml file (The file is locked by another process)
Status: RESOLVED FIXED
Alias: None
Product: kwordquiz
Classification: Applications
Component: general (other bugs)
Version First Reported In: 22.04.3
Platform: Arch Linux Linux
: NOR critical
Target Milestone: ---
Assignee: Peter Hedlund
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-14 11:04 UTC by Phos
Modified: 2022-08-04 18:35 UTC (History)
2 users (show)

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


Attachments
output of "backtrace full" with coredumpctl gdb and debuginfod (5.27 KB, text/plain)
2022-07-14 19:36 UTC, Phos
Details
file that causes crashes (2.44 KB, application/x-kvtml)
2022-07-21 13:20 UTC, Phos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Phos 2022-07-14 11:04:30 UTC
SUMMARY
When opening a .kvtml file it crashes with the error "The file is locked by another process". This problem persists after restarting the computer.


STEPS TO REPRODUCE
1. Open a .kvtml file
2. See the crash message

OBSERVED RESULT
KWordQuiz crashes after opening the file.

EXPECTED RESULT
It doesn't crash

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.25.2
KDE Frameworks Version: 5.96.0
Qt Version: 5.15.5
Kernel Version: 5.18.10-zen1-1-zen (64-bit)
Graphics Platform: Wayland

ADDITIONAL INFORMATION
I get this output when running from the terminal

"Cannot lock file /home/test/Desktop/Test/test.kvtml"
 Error: Invalid identifier index:  0
Comment 1 Phos 2022-07-14 19:36:34 UTC
Created attachment 150632 [details]
output of "backtrace full" with coredumpctl gdb and debuginfod
Comment 2 Albert Astals Cid 2022-07-20 21:15:08 UTC
Can't reproduce can you attach the kvtml file that makes it crash?
Comment 3 Phos 2022-07-21 13:17:48 UTC
(In reply to Albert Astals Cid from comment #2)
> Can't reproduce can you attach the kvtml file that makes it crash?
Its not the file that causes it to crash, so the file isn't useful. For example, if I rename the same file (that causes it to crash) from test.kvtml to test2.kvtml it won't crash anymore. Renaming it back to test.kvtml will cause it to crash again
Comment 4 Phos 2022-07-21 13:19:27 UTC
I've attached the file, but examining it, I can't find any differences between the one that crashes and the one that doesn't
Comment 5 Phos 2022-07-21 13:20:29 UTC
Created attachment 150789 [details]
file that causes crashes
Comment 6 Phos 2022-07-21 15:02:07 UTC
I installed the flatpak version of kwordquiz and opening the same file (that causes crashes) doesn't cause crashes.

No idea why
Comment 7 Albert Astals Cid 2022-07-21 21:24:55 UTC
Can you list the files that are in  /home/test/Desktop/Test (including hidden files, remove anything that you think infringes your privacy) ?

Anything that may look like a similar name to the test.kvtml file you're opening?
Comment 8 Phos 2022-07-22 16:34:45 UTC
(In reply to Albert Astals Cid from comment #7)
> Can you list the files that are in  /home/test/Desktop/Test (including
> hidden files, remove anything that you think infringes your privacy) ?
> 
> Anything that may look like a similar name to the test.kvtml file you're
> opening?

The only file there is the test file in that folder.
There is nothing else.
Its why I'm not sure why this issue is occuring.
Comment 9 Phos 2022-07-22 16:37:13 UTC
Huh, the flatpak version of kwordquiz is now exhibiting the same issue as the normal package. First it gives me the error "File not readable" then it says the same "The file is locked by another process" when opening it the second time.
Comment 10 Albert Astals Cid 2022-07-22 20:26:14 UTC
(In reply to Phos from comment #8)
> (In reply to Albert Astals Cid from comment #7)
> > Can you list the files that are in  /home/test/Desktop/Test (including
> > hidden files, remove anything that you think infringes your privacy) ?
> > 
> > Anything that may look like a similar name to the test.kvtml file you're
> > opening?
> 
> The only file there is the test file in that folder.
> There is nothing else.
> Its why I'm not sure why this issue is occuring.

You sure? Not even hidden files? run 
  ls -la 
on the folder
Comment 11 Phos 2022-07-23 02:53:16 UTC
(In reply to Albert Astals Cid from comment #10)
> (In reply to Phos from comment #8)
> > (In reply to Albert Astals Cid from comment #7)
> > > Can you list the files that are in  /home/test/Desktop/Test (including
> > > hidden files, remove anything that you think infringes your privacy) ?
> > > 
> > > Anything that may look like a similar name to the test.kvtml file you're
> > > opening?
> > 
> > The only file there is the test file in that folder.
> > There is nothing else.
> > Its why I'm not sure why this issue is occuring.
> 
> You sure? Not even hidden files? run 
>   ls -la 
> on the folder

Yep, there's nothing apart from the usual
Comment 12 xiretza 2022-07-23 07:07:55 UTC
The problematic state files seem to be located in ~/.local/share/stalefiles/kwordquiz/. Deleting all files from there (not just the .lock files) fixes the problem. KWordQuiz should handle these files appropriately, be it by simply ignoring them (by passing FileHandlingFlags::FileIgnoreLock to KEduVocDocument::open) or by doing some more advanced recovery.
Comment 13 Phos 2022-07-24 03:08:48 UTC
(In reply to xiretza from comment #12)
> The problematic state files seem to be located in
> ~/.local/share/stalefiles/kwordquiz/. Deleting all files from there (not
> just the .lock files) fixes the problem. KWordQuiz should handle these files
> appropriately, be it by simply ignoring them (by passing
> FileHandlingFlags::FileIgnoreLock to KEduVocDocument::open) or by doing some
> more advanced recovery.

Deleting all the files in ~/.local/share/stalefiles/kwordquiz doesn't fix the problem. It gives the "File is not readable" when trying to open the .kvtml file the first time then outputting "The File is locked by another process" when opening the same file the second time
Comment 14 Phos 2022-07-24 03:12:28 UTC
(In reply to Phos from comment #13)
> (In reply to xiretza from comment #12)
> > The problematic state files seem to be located in
> > ~/.local/share/stalefiles/kwordquiz/. Deleting all files from there (not
> > just the .lock files) fixes the problem. KWordQuiz should handle these files
> > appropriately, be it by simply ignoring them (by passing
> > FileHandlingFlags::FileIgnoreLock to KEduVocDocument::open) or by doing some
> > more advanced recovery.
> 
> Deleting all the files in ~/.local/share/stalefiles/kwordquiz doesn't fix
> the problem. It gives the "File is not readable" when trying to open the
> .kvtml file the first time then outputting "The File is locked by another
> process" when opening the same file the second time

IGNORE WHAT I WROTE PREVIOUSLY, IT WAS INCORRECT (I had the flatpak version installed which is why deleting those files did nothing)

When I tested it again after deleting the files in ~/.local/share/stalefiles/kwordquiz it works again.
So kwordquiz is not handling the lock files correctly for some reason.
Comment 15 Bug Janitor Service 2022-08-02 22:49:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/education/kwordquiz/-/merge_requests/12
Comment 16 Albert Astals Cid 2022-08-02 23:01:49 UTC
Git commit 3b3d851d709c81514f78d11559fba35207041c53 by Albert Astals Cid.
Committed on 02/08/2022 at 22:48.
Pushed by aacid into branch 'release/22.08'.

Fix crash if opening a file fails

M  +3    -0    src/kwordquiz.cpp

https://invent.kde.org/education/kwordquiz/commit/3b3d851d709c81514f78d11559fba35207041c53
Comment 17 Bug Janitor Service 2022-08-02 23:03:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/education/kwordquiz/-/merge_requests/13
Comment 18 Albert Astals Cid 2022-08-04 18:35:04 UTC
Git commit 4d28a1a04c1897016228dd51e3bf24a3a8854037 by Albert Astals Cid.
Committed on 04/08/2022 at 18:22.
Pushed by aacid into branch 'release/22.08'.

Allow users to still open a file even if it's locked

File locked can happen if kwordquiz had crashed

M  +10   -4    src/kwordquiz.cpp
M  +2    -2    src/kwordquiz.h

https://invent.kde.org/education/kwordquiz/commit/4d28a1a04c1897016228dd51e3bf24a3a8854037