Fix segfaults when killing running jobs
AbandonedPublic

Authored by rthomsen on Apr 20 2016, 8:21 PM.

Details

Reviewers
elvisangelaccio
Summary

Currently Ark segfaults when either stopping a running job using the notifications system tray icon or simply closing Ark while a job is running.

To fix libarchiveplugin we need to connect the finished signal of Job to QThread::terminate() instead of QThread::quit() in the worker thread. This is likely due to the event loop of the worker thread already being dead and hence quit() having no effect.

For CliInterface we simply wait for 1 second after killing the process. This avoids the assertion failure in destructor of CliInterface.

When closing Ark main window while a job is running Ark crashes due to KJob::finished signal being connected to Part::ready and the JobTracker destructor killing the job non-quietly. This is fixed by connecting to KJob::result instead and killing the job quietly (KJob::result is not emitted when job is killed quietly).

Bugs:
222392
358937

Test Plan

Test using AddToArchive:
ark -t <archive_name> <some_folder_with_many_files>
then stop the job using system tray. Try both with e.g. a tar.xz and a zip archive.

Test using GUI:
Create a new archive and add a large folder using Add Folder action. Then close Ark while AddJob is running. Again try both with e.g. a tar.xz and a zip archive.

Diff Detail

Repository
R36 Ark
Lint
Lint Skipped
Unit
Unit Tests Skipped
rthomsen updated this revision to Diff 3437.Apr 20 2016, 8:21 PM
rthomsen retitled this revision from to Fix segfaults when killing running jobs.
rthomsen updated this object.
rthomsen edited the test plan for this revision. (Show Details)
rthomsen added a reviewer: elvisangelaccio.
rthomsen set the repository for this revision to R36 Ark.
rthomsen added a project: Ark.
Restricted Application added a subscriber: kde-utils-devel. ยท View Herald TranscriptApr 20 2016, 8:21 PM
elvisangelaccio requested changes to this revision.Apr 20 2016, 9:43 PM
elvisangelaccio edited edge metadata.

I did not have time to properly test the patch. However with this patch I get a failing jobstest, and Ark still crashes after closing the GUI while opening a huge archive (the backtrace is different though). I'll try to have a look tomorrow

part/part.cpp
198

Sorry this is my fault :(
See in task T2225 why I have done this change. We need to find another fix for that bug...

This revision now requires changes to proceed.Apr 20 2016, 9:43 PM

Actually I get 3 failing tests: addtoarchivetest, archivetest and jobstest

However, the 1 second delay in cliinterface works and the tests pass. Please commit this change in a separate patch!