1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #-: Fix occasional crash on exit (#1242)

This commit is contained in:
Pavel Czerný 2021-05-21 23:25:37 +02:00 committed by Ruben S. Montero
parent 8348f361ad
commit 8d19f067fd
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,8 @@
#include "DriverManager.h"
#include "Listener.h"
#include <atomic>
class MarketPlacePool;
class MarketPlaceAppPool;
class ImagePool;
@ -60,6 +62,8 @@ public:
*/
void finalize()
{
terminate = true;
timer_thread.stop();
DriverManager::stop(drivers_timeout);
@ -167,6 +171,11 @@ private:
*/
RaftManager * raftm = nullptr;
/**
* Manager is terminating, do not execute any action
*/
std::atomic<bool> terminate{false};
/**
* Returns a pointer to the marketplace driver.
* @return the marketplace manager driver or 0 in not found

View File

@ -253,6 +253,11 @@ void MarketPlaceManager::_monitor(unique_ptr<market_msg_t> msg)
for (int i=0; i< num; i++)
{
if (terminate)
{
return; // Prevent crash on exit, while processing long msg
}
int app_id;
int rc = apppool->import(apps[i]->value(), id, name, app_id, err);