Skip to content

Commit

Permalink
Merge #632
Browse files Browse the repository at this point in the history
632: qemu: Remove QCoreApplication::processEvents() to avoid a crash r=ricab a=townsend2010

Due to how we are interacting with the Qt event loop, it's possible to crash
when deleting an instance while it's still launching. The after effect of this
is that concurrent client connections will block until launch (or other long
running commands) finishes.

A plan has been fleshed out to alleviate the concurrent blocking and will be
implemented later.

Fixes #585

Co-authored-by: Chris Townsend <[email protected]>
  • Loading branch information
bors[bot] and Chris Townsend committed Feb 22, 2019
2 parents 2cc4464 + 17d3713 commit 4cf3ca1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 2 additions & 3 deletions include/multipass/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <thread>
#include <vector>

#include <QCoreApplication>
#include <QDir>
#include <QString>
#include <QStringList>
Expand Down Expand Up @@ -65,9 +64,9 @@ std::string generate_mac_address();
std::string timestamp();
bool is_running(const VirtualMachine::State& state);
void wait_until_ssh_up(VirtualMachine* virtual_machine, std::chrono::milliseconds timeout,
std::function<void()> const& process_vm_events = []() { QCoreApplication::processEvents(); });
std::function<void()> const& process_vm_events = []() { });
void wait_for_cloud_init(VirtualMachine* virtual_machine, std::chrono::milliseconds timeout,
std::function<void()> const& process_vm_events = []() { QCoreApplication::processEvents(); });
std::function<void()> const& process_vm_events = []() { });

enum class TimeoutAction
{
Expand Down
2 changes: 0 additions & 2 deletions src/platform/backends/qemu/qemu_virtual_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,6 @@ void mp::QemuVirtualMachine::on_restart()

void mp::QemuVirtualMachine::ensure_vm_is_running()
{
QCoreApplication::processEvents();

if (vm_process->state() == QProcess::NotRunning)
throw mp::StartException(vm_name, saved_error_msg);
}
Expand Down

0 comments on commit 4cf3ca1

Please sign in to comment.