Bug 420074 - DJVU thumbnailer crashes kdeinit
Summary: DJVU thumbnailer crashes kdeinit
Status: RESOLVED FIXED
Alias: None
Product: kio-extras
Classification: Frameworks and Libraries
Component: Thumbnails and previews (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
: 420542 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-04-14 09:44 UTC by Ilya Bizyaev
Modified: 2020-09-22 13:51 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
attachment-28567-0.html (1.58 KB, text/html)
2020-09-16 06:29 UTC, Martin Mirchev
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Bizyaev 2020-04-14 09:44:45 UTC
SUMMARY
Application: kdeinit5 (kdeinit5), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[KCrash Handler]
#6  0x00007ffb79af781e in pthread_join () from /lib64/libpthread.so.0
#7  0x00007ffb5b568c47 in thrd_join (res=0x0, thr=<optimized out>) at ../include/c11/threads_posix.h:329
#8  util_queue_kill_threads (queue=0x7ffb64002c40, keep_num_threads=<optimized out>, finish_locked=<optimized out>) at ../src/util/u_queue.c:496
#9  0x00007ffb5b568cdc in atexit_handler () at ../src/util/u_queue.c:62
#10 0x00007ffb7b40c138 in __run_exit_handlers () from /lib64/libc.so.6
#11 0x00007ffb7b40c18a in exit () from /lib64/libc.so.6
#12 0x00007ffb4ab2f9e8 in DjVuCreator::create (this=this@entry=0x557c085bff60, path=..., width=width@entry=128, height=height@entry=128, img=...) at /usr/src/debug/kio-extras5-19.12.3-lp151.1.2.x86_64/thumbnail/djvucreator.cpp:77
#13 0x00007ffb6cecd297 in ThumbnailProtocol::get (this=0x7ffe9d36c8e0, url=...) at /usr/src/debug/kio-extras5-19.12.3-lp151.1.2.x86_64/thumbnail/thumbnail.cpp:266
#14 0x00007ffb739ed7fd in KIO::SlaveBase::dispatch (this=0x7ffe9d36c8e0, command=67, data=...) at /usr/src/debug/kio-5.69.0-lp151.286.1.x86_64/src/core/slavebase.cpp:1198
#15 0x00007ffb739ee0e6 in KIO::SlaveBase::dispatchLoop (this=this@entry=0x7ffe9d36c8e0) at /usr/src/debug/kio-5.69.0-lp151.286.1.x86_64/src/core/slavebase.cpp:338
#16 0x00007ffb6ceca920 in kdemain (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kio-extras5-19.12.3-lp151.1.2.x86_64/thumbnail/thumbnail.cpp:138
#17 0x0000557c066695ff in launch (argc=4, _name=0x557c0821c8b8 "/usr/lib64/qt5/plugins/kf5/kio/thumbnail.so", args=<optimized out>, cwd=<optimized out>, envc=0, envs=<optimized out>, reset_env=false, tty=0x0, avoid_loops=false, startup_id_str=0x557c0666be73 "0") at /usr/src/debug/kinit-5.69.0-lp151.207.1.x86_64/src/kdeinit/kinit.cpp:708
#18 0x0000557c0666a73c in handle_launcher_request (sock=7, who=<optimized out>) at /usr/src/debug/kinit-5.69.0-lp151.207.1.x86_64/src/kdeinit/kinit.cpp:1146
#19 0x0000557c0666b0af in handle_requests (waitForPid=0) at /usr/src/debug/kinit-5.69.0-lp151.207.1.x86_64/src/kdeinit/kinit.cpp:1339
#20 0x0000557c0666642c in main (argc=1, argv=<optimized out>) at /usr/src/debug/kinit-5.69.0-lp151.207.1.x86_64/src/kdeinit/kinit.cpp:1777
[Inferior 1 (process 25427) detached]

STEPS TO REPRODUCE
Happens to me when opening folders with DJVU documents in them

OBSERVED RESULT
No thumbnails, drkonqi's crash message

EXPECTED RESULT
Thumbnails are generated

SOFTWARE/OS VERSIONS
Operating System: openSUSE Leap 15.1
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.69.0
Qt Version: 5.14.1
Kernel Version: 5.6.0-2.gbf56c5b-default
OS Type: 64-bit
Comment 1 Kai Uwe Broulik 2020-04-14 09:47:20 UTC
Calls
> exit(1);
But this is the child process.
Comment 2 Méven Car 2020-05-17 07:45:10 UTC
*** Bug 420542 has been marked as a duplicate of this bug. ***
Comment 3 Norbert Preining 2020-09-15 16:00:50 UTC
I just realized that this is simply because `ddjvu` the program is not available. This means that in the pid==0 case the execvp fails and drops down to the exit(1).

On my system, where I had the same problem, a simple installation of djvulibre-bin package fixed the crashes.
Comment 4 Martin Mirchev 2020-09-16 06:29:13 UTC
Created attachment 131689 [details]
attachment-28567-0.html

Okay, so this means it can be added as general info for the tooltip right?

On Tue, Sep 15, 2020, 18:00 Norbert Preining <bugzilla_noreply@kde.org>
wrote:

> https://bugs.kde.org/show_bug.cgi?id=420074
>
> Norbert Preining <norbert@preining.info> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |norbert@preining.info
>
> --- Comment #3 from Norbert Preining <norbert@preining.info> ---
> I just realized that this is simply because `ddjvu` the program is not
> available. This means that in the pid==0 case the execvp fails and drops
> down
> to the exit(1).
>
> On my system, where I had the same problem, a simple installation of
> djvulibre-bin package fixed the crashes.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 5 Norbert Preining 2020-09-16 06:32:39 UTC
(In reply to Martin Mirchev from comment #4)
> Okay, so this means it can be added as general info for the tooltip right?

Not sure what you mean with "tooltip", I see two options:

- either make ddjvu binary a hard dependency via CMakeFile
- fix the code that it does not crash (not call exit) if ddjvu is not available

Both are possible solutions, but the current state is sub-optimal.
Comment 6 Martin Mirchev 2020-09-16 06:35:27 UTC
Sorry, making it a dependency would be a best option but I do not really 
know how many people use Djvu these days so it may come as extra bloat 
for some people.

On 9/16/20 8:32 AM, Norbert Preining wrote:
> https://bugs.kde.org/show_bug.cgi?id=420074
>
> --- Comment #5 from Norbert Preining <norbert@preining.info> ---
> (In reply to Martin Mirchev from comment #4)
>> Okay, so this means it can be added as general info for the tooltip right?
> Not sure what you mean with "tooltip", I see two options:
>
> - either make ddjvu binary a hard dependency via CMakeFile
> - fix the code that it does not crash (not call exit) if ddjvu is not available
>
> Both are possible solutions, but the current state is sub-optimal.
>
Comment 7 Norbert Preining 2020-09-16 07:25:03 UTC
(In reply to Martin Mirchev from comment #6)
> Sorry, making it a dependency would be a best option but I do not really 
> know how many people use Djvu these days so it may come as extra bloat 
> for some people.

Well, the correct solution is to use
   _exit(1);
instead of
  exit(1);
because the normal exit(1) triggers the atexit registered functions to be executed, and that is not what we want (and crashed kdeinit5).

I can confirm that with _exit(1) instead all works as expected - just that there are no thumbnails available, well, also this is expected.
Comment 8 Martin Mirchev 2020-09-16 07:27:56 UTC
Okay, that is nice. Well all is good, I assume you can close the issue. 
Hope I helped

On 9/16/20 9:25 AM, Norbert Preining wrote:
> https://bugs.kde.org/show_bug.cgi?id=420074
>
> --- Comment #7 from Norbert Preining <norbert@preining.info> ---
> (In reply to Martin Mirchev from comment #6)
>> Sorry, making it a dependency would be a best option but I do not really
>> know how many people use Djvu these days so it may come as extra bloat
>> for some people.
> Well, the correct solution is to use
>     _exit(1);
> instead of
>    exit(1);
> because the normal exit(1) triggers the atexit registered functions to be
> executed, and that is not what we want (and crashed kdeinit5).
>
> I can confirm that with _exit(1) instead all works as expected - just that
> there are no thumbnails available, well, also this is expected.
>
Comment 9 Norbert Preining 2020-09-16 07:35:45 UTC
Ok, I sent a merge request for this code. When it is merged, this bug can be closed, but for now it is still valid.
Comment 10 Bug Janitor Service 2020-09-18 22:37:52 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kio-extras/-/merge_requests/30
Comment 11 Stefan Brüns 2020-09-22 13:51:23 UTC
Git commit 015a265d32bc216d198410f11d63cbf84245c124 by Stefan Brüns.
Committed on 22/09/2020 at 13:49.
Pushed by bruns into branch 'master'.

[DjvuThumbnailer] Replace open coded ddjvu invocation with QProcess

This also fixes a kdeinit crash due to calling exit(1) in case
execvp failed (e.g. due to a missing ddjvu binary).

M  +5    -0    thumbnail/CMakeLists.txt
M  +29   -107  thumbnail/djvucreator.cpp
M  +5    -20   thumbnail/djvucreator.h

https://invent.kde.org/network/kio-extras/commit/015a265d32bc216d198410f11d63cbf84245c124