Bug 377639 - Crash in "'CTest' is already being executed" dialog.
Summary: Crash in "'CTest' is already being executed" dialog.
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Build tools: CMake (show other bugs)
Version: 5.1.0
Platform: Compiled Sources Linux
: HI crash
Target Milestone: 5.1.2
Assignee: kdevelop-bugs-null
URL:
Keywords: release_blocker
: 372795 374003 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-03-15 12:05 UTC by Francis Herne
Modified: 2020-10-23 20:21 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.6.1


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francis Herne 2017-03-15 12:05:04 UTC
Using kdevelop/platform 5.1-git.

When opening the kdevelop/kdevplatform projects in a session, and executing "Run -> Run All Tests", many dialogs popup with the message:
`
'CTest' is already being executed. Should we kill the previous instance?
`
I spent a few seconds randomly clicking 'Yes' or 'No' on each box, being curious about how many there were and whether they'd go away eventually...

After closing maybe a dozen pupups, KDevelop crashed with the backtrace below.

Maybe some race condition where the test finished/exited/crashed before closing the popup? Also, may be a duplicate of https://bugs.kde.org/show_bug.cgi?id=374003.

================================

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000000000 in ?? ()
[Current thread is 1 (Thread 0x7ffa2f3b0800 (LWP 20941))]
(gdb) bt
#0  0x0000000000000000 in  ()
#1  0x00007ffa286612c9 in QMetaObject::cast(QObject const*) const () at /usr/lib/libQt5Core.so.5
#2  0x00007ff9f9227854 in qobject_cast<NativeAppJob*>(QObject*) (object=0xba382b0) at /usr/include/qt/QtCore/qobject.h:499
#3  0x00007ff9f9227042 in findNativeJob(KJob*) (j=0xba382b0) at /home/flh/projects/kdevplatform/plugins/execute/nativeappjob.cpp:124
#4  0x00007ff9f922718f in NativeAppJob::start() (this=0xbe7cc40) at /home/flh/projects/kdevplatform/plugins/execute/nativeappjob.cpp:137
#5  0x00007ffa2db1b0da in KDevelop::ExecuteCompositeJobPrivate::startNextJob(KJob*) (this=0xbe71140, job=0xbe7cc40) at /home/flh/projects/kdevplatform/util/executecompositejob.cpp:63
#6  0x00007ffa2db1b124 in KDevelop::ExecuteCompositeJob::start() (this=0xbe7b1f0) at /home/flh/projects/kdevplatform/util/executecompositejob.cpp:69
#7  0x00007ffa2ef66dc9 in KDevelop::RunController::registerJob(KJob*) (this=0x1dc0b00, job=0xbe7b1f0) at /home/flh/projects/kdevplatform/shell/runcontroller.cpp:623
#8  0x00007ffa2ef64e8e in KDevelop::RunController::execute(QString const&, KDevelop::ILaunchConfiguration*) (this=0x1dc0b00, runMode=..., launch=0x87f9430)
    at /home/flh/projects/kdevplatform/shell/runcontroller.cpp:441
#9  0x00007ff9da50057e in createTestJob(QString, QStringList) (launchModeId=..., arguments=...) at /home/flh/projects/kdevelop/projectmanagers/cmake/testing/ctestrunjob.cpp:99
#10 0x00007ff9da500774 in CTestRunJob::start() (this=0xbe50230) at /home/flh/projects/kdevelop/projectmanagers/cmake/testing/ctestrunjob.cpp:120
#11 0x00007ffa2db1b0da in KDevelop::ExecuteCompositeJobPrivate::startNextJob(KJob*) (this=0xbd93840, job=0xbe50230) at /home/flh/projects/kdevplatform/util/executecompositejob.cpp:63
#12 0x00007ffa2db1b124 in KDevelop::ExecuteCompositeJob::start() (this=0xbe50200) at /home/flh/projects/kdevplatform/util/executecompositejob.cpp:69
#13 0x00007ffa2ef66dc9 in KDevelop::RunController::registerJob(KJob*) (this=0x1dc0b00, job=0xbe50200) at /home/flh/projects/kdevplatform/shell/runcontroller.cpp:623
#14 0x00007ff9f3df4db9 in TestViewPlugin::runAllTests() (this=0x21d74b0) at /home/flh/projects/kdevplatform/plugins/testview/testviewplugin.cpp:124
#15 0x00007ff9f3df6586 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (TestViewPlugin::*)()>::call(void (TestViewPlugin::*)(), TestViewPlugin*, void**) (f=(void (TestViewPlugin::*)(TestViewPlugin * const)) 0x7ff9f3df4a44 <TestViewPlugin::runAllTests()>, o=0x21d74b0, arg=0x7ffc510719c0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:143
#16 0x00007ff9f3df6362 in QtPrivate::FunctionPointer<void (TestViewPlugin::*)()>::call<QtPrivate::List<>, void>(void (TestViewPlugin::*)(), TestViewPlugin*, void**) (f=(void (TestViewPlugin::*)(TestViewPlugin * const)) 0x7ff9f3df4a44 <TestViewPlugin::runAllTests()>, o=0x21d74b0, arg=0x7ffc510719c0) at /usr/include/qt/QtCore/qobjectdefs_impl.h:162
#17 0x00007ff9f3df60cb in QtPrivate::QSlotObject<void (TestViewPlugin::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x21e3c60, r=0x21d74b0, a=0x7ffc510719c0, ret=0x0) at /usr/include/qt/QtCore/qobject_impl.h:120
#18 0x00007ffa286840be in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#19 0x00007ffa29333c92 in QAction::triggered(bool) () at /usr/lib/libQt5Widgets.so.5
#20 0x00007ffa293363f0 in QAction::activate(QAction::ActionEvent) () at /usr/lib/libQt5Widgets.so.5
#21 0x00007ffa294a5f6a in  () at /usr/lib/libQt5Widgets.so.5
#22 0x00007ffa294ad304 in  () at /usr/lib/libQt5Widgets.so.5
#23 0x00007ffa294ae1a0 in QMenu::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt5Widgets.so.5
#24 0x00007ffa29381cd8 in QWidget::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#25 0x00007ffa294b0513 in QMenu::event(QEvent*) () at /usr/lib/libQt5Widgets.so.5
#26 0x00007ffa2933a34c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#27 0x00007ffa293428c5 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#28 0x00007ffa28658440 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#29 0x00007ffa293410cd in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib/libQt5Widgets.so.5
#30 0x00007ffa2939c7f6 in  () at /usr/lib/libQt5Widgets.so.5
#31 0x00007ffa2939ee03 in  () at /usr/lib/libQt5Widgets.so.5
#32 0x00007ffa2933a34c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#33 0x00007ffa29341b61 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#34 0x00007ffa28658440 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#35 0x00007ffa28ba5d53 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt5Gui.so.5
#36 0x00007ffa28ba78c5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/libQt5Gui.so.5
#37 0x00007ffa28b8344b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Gui.so.5
#38 0x00007ffa107c59e0 in  () at /usr/lib/libQt5XcbQpa.so.5
#39 0x00007ffa1c0305a7 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#40 0x00007ffa1c030810 in  () at /usr/lib/libglib-2.0.so.0
#41 0x00007ffa1c0308bc in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#42 0x00007ffa286ad04f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#43 0x00007ffa2865689a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#44 0x00007ffa2865ede4 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#45 0x000000000040f341 in main(int, char**) (argc=3, argv=0x7ffc51074b78) at /home/flh/projects/kdevelop/app/main.cpp:763
Comment 1 Kevin Funk 2017-07-06 21:51:09 UTC
Just experienced this. This basically renders the Unit Test view useless.

@Apol: Could you have a look maybe?
Comment 2 Kevin Funk 2017-07-06 21:52:14 UTC
*** Bug 374003 has been marked as a duplicate of this bug. ***
Comment 3 Christoph Roick 2017-07-07 20:08:23 UTC
This should be fixed with commit https://phabricator.kde.org/R33:3ed8698f1baca73e2d7cb4400c90e6950a8ad623 already.
Comment 4 Christoph Roick 2017-07-07 21:36:29 UTC
(In reply to Christoph Roick from comment #3)
> This should be fixed with commit
> https://phabricator.kde.org/R33:3ed8698f1baca73e2d7cb4400c90e6950a8ad623
> already.

Well, it's not, since jobs may mutually kill each other. I managed to fix the NativeAppJob, but now it randomly crashes somewhere else.
Comment 5 Igor Kushnir 2020-09-14 17:40:14 UTC
This crash still happens in KDevelop 5.6. Because of https://commits.kde.org/kdevelop/d896e7489b743d8691e480378c86f2b1ee0524b0 the message and the button texts are different now. For example, when I open 3 projects - drkonqi, kdevelop, kio - and Run All Tests, I get one or more {"Job Already Running", "'cmake' is already being executed."} dialogs with three buttons: "Cancel", "Kill All Instances", "Start Another". Only "Start Another" is safe (and obviously the correct choice). The other two choices usually end in a crash (either immediate or after I stop the stuck test jobs).

I think that the proper fix is to not show this dialog in such situations. Either mark the jobs as "internal" and always silently "start another", or assign unique names to these jobs so that NativeAppJob doesn't consider them equal.
Comment 6 Igor Kushnir 2020-09-14 17:41:49 UTC
*** Bug 372795 has been marked as a duplicate of this bug. ***
Comment 7 Christoph Roick 2020-09-14 21:46:10 UTC
How exactly do you reproduce the behavior? I created a session with the three projects you mention and selected "Run All Tests", but there is no dialog showing up about a cmake job.
Comment 8 Igor Kushnir 2020-09-15 02:49:55 UTC
(In reply to Christoph Roick from comment #7)
> How exactly do you reproduce the behavior? I created a session with the
> three projects you mention and selected "Run All Tests", but there is no
> dialog showing up about a cmake job.
I have noticed that the tests do not appear right after opening projects. You have to wait for the projects to be parsed and their tests to appear in Unit Tests tool view. The dialog appears more reliably (even with just two open projects, e.g. kio and ktexteditor) in KDevelop built in Debug mode, though I have no problem triggering it in Release either.
Comment 9 Bug Janitor Service 2020-09-15 23:36:08 UTC
A possibly relevant merge request was started @ https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/165
Comment 10 Christoph Roick 2020-10-23 20:21:30 UTC
Git commit a48287f4289cbe56c5affdb8735603b793cf0f1c by Christoph Roick.
Committed on 23/10/2020 at 20:21.
Pushed by croick into branch '5.6'.

Do not block "Run All Tests" by dialog

- always start a new test job without asking to kill running jobs
  * disable the combo box in the launch config interface

By default, app jobs are compared by their executable name. If a new job
name matches an old job, a dialog pops up to ask whether the old instance
shall be killed. This blocks the "Run All Tests" function under some
circumstances (for instance when "cmake" is used to invoke the test).
The patch always makes a CTest-generated job run without asking the user.
FIXED-IN: 5.6.1

M  +1    -0    plugins/execute/executeplugin.cpp
M  +1    -0    plugins/execute/executeplugin.h
M  +9    -5    plugins/execute/nativeappconfig.cpp
M  +14   -12   plugins/execute/nativeappjob.cpp
M  +8    -1    plugins/execute/nativeappjob.h

https://invent.kde.org/kdevelop/kdevelop/commit/a48287f4289cbe56c5affdb8735603b793cf0f1c