1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-1474 Catch errors in PriorityThreadPool

PriorityThreadPool errors cause crashes in PrimProc. This patch catches
the errors and causes the thread to end cleanly.
This commit is contained in:
Andrew Hutchings
2018-06-14 14:43:37 +01:00
parent 4a20da68ac
commit 250d90a9bc

View File

@ -111,6 +111,8 @@ void PriorityThreadPool::threadFcn(const Priority preferredQueue) throw()
uint32_t rescheduleCount;
uint32_t queueSize;
try
{
while (!_stop) {
mutex::scoped_lock lk(mutex);
@ -169,6 +171,53 @@ void PriorityThreadPool::threadFcn(const Priority preferredQueue) throw()
}
runList.clear();
}
}
catch (std::exception &ex)
{
// Log the exception and exit this thread
try
{
#ifndef NOLOGGING
logging::Message::Args args;
logging::Message message(5);
args.add("threadFcn: Caught exception: ");
args.add(ex.what());
message.format( args );
logging::LoggingID lid(22);
logging::MessageLog ml(lid);
ml.logErrorMessage( message );
#endif
}
catch (...)
{
}
}
catch (...)
{
// Log the exception and exit this thread
try
{
#ifndef NOLOGGING
logging::Message::Args args;
logging::Message message(6);
args.add("threadFcn: Caught unknown exception!");
message.format( args );
logging::LoggingID lid(22);
logging::MessageLog ml(lid);
ml.logErrorMessage( message );
#endif
}
catch (...)
{
}
}
}
void PriorityThreadPool::stop()