From 877dc201bdb0158263691dad8b8df81f729e246f Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Sun, 23 Oct 2016 16:12:38 +0100 Subject: [PATCH 1/3] MCOL-371 fix mutex free crash It is possible for an exception to be thrown when a memory limit is hit whilst a mutex is lock. That mutex is never unlocked and in Ubuntu 16.04 release build it can cause a crash when freed. This patch catches the exception, releases the lock and then re-throws. --- dbcon/joblist/tupleaggregatestep.cpp | 34 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/dbcon/joblist/tupleaggregatestep.cpp b/dbcon/joblist/tupleaggregatestep.cpp index 695878710..595cb174d 100644 --- a/dbcon/joblist/tupleaggregatestep.cpp +++ b/dbcon/joblist/tupleaggregatestep.cpp @@ -348,10 +348,18 @@ void TupleAggregateStep::doThreadedSecondPhaseAggregate(uint32_t threadID) { if (!bucketDone[c] && fAgg_mutex[c]->try_lock()) { - if (multiDist) - dynamic_cast(fAggregators[c].get())->doDistinctAggregation_rowVec(rowBucketVecs[c]); - else - dynamic_cast(fAggregators[c].get())->doDistinctAggregation_rowVec(rowBucketVecs[c][0]); + try + { + if (multiDist) + dynamic_cast(fAggregators[c].get())->doDistinctAggregation_rowVec(rowBucketVecs[c]); + else + dynamic_cast(fAggregators[c].get())->doDistinctAggregation_rowVec(rowBucketVecs[c][0]); + } + catch(...) + { + fAgg_mutex[c]->unlock(); + throw; + } fAgg_mutex[c]->unlock(); bucketDone[c] = true; rowBucketVecs[c][0].clear(); @@ -4301,11 +4309,19 @@ void TupleAggregateStep::threadedAggregateRowGroups(uint32_t threadID) { if (!fEndOfResult && !bucketDone[c] && fAgg_mutex[c]->try_lock()) { - didWork = true; - if (multiDist) - dynamic_cast(fAggregators[c].get())->addRowGroup(&fRowGroupIns[threadID], rowBucketVecs[c]); - else - fAggregators[c]->addRowGroup(&fRowGroupIns[threadID], rowBucketVecs[c][0]); + try + { + didWork = true; + if (multiDist) + dynamic_cast(fAggregators[c].get())->addRowGroup(&fRowGroupIns[threadID], rowBucketVecs[c]); + else + fAggregators[c]->addRowGroup(&fRowGroupIns[threadID], rowBucketVecs[c][0]); + } + catch(...) + { + fAgg_mutex[c]->unlock(); + throw; + } fAgg_mutex[c]->unlock(); rowBucketVecs[c][0].clear(); bucketDone[c] = true; From 2727fc498d05e91d21ab67652f4967b2171f8451 Mon Sep 17 00:00:00 2001 From: david hill Date: Mon, 24 Oct 2016 14:11:42 +0000 Subject: [PATCH 2/3] no error logging from checkLogFile, arent needed and issues unwanted error logs --- oam/oamcpp/liboamcpp.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/oam/oamcpp/liboamcpp.cpp b/oam/oamcpp/liboamcpp.cpp index b06d5945f..415bcc59f 100644 --- a/oam/oamcpp/liboamcpp.cpp +++ b/oam/oamcpp/liboamcpp.cpp @@ -4644,9 +4644,7 @@ namespace oam if (!file.is_open()) { - ostringstream os; - os << "checkLogStatus error while opening file " << fileName << " " << strerror(errno); - writeLog(os.str(), LOG_TYPE_ERROR ); + return false; } string buf; @@ -4659,14 +4657,9 @@ namespace oam } if (file.bad()) { - ostringstream os; - os << "checkLogStatus error while reading file " << fileName << " " << strerror(errno); - writeLog(os.str(), LOG_TYPE_ERROR ); + return false; } file.close(); - ostringstream os; - os << "checkLogStatus failed " << fileName << " expected \"" << phrase.c_str() << "\" found \"" << buf.c_str() << "\""; - writeLog(os.str(), LOG_TYPE_ERROR ); return false; } From b1a110b830ab73adc4956ec57fd2931094080fcb Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 24 Oct 2016 17:30:05 -0500 Subject: [PATCH 3/3] MCOL-121 client reports "stage 2 - enabling keys" for every query against a CS table. Add progress_report_time=0 to default my.cnf to disable progress reports --- dbcon/mysql/my.cnf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dbcon/mysql/my.cnf b/dbcon/mysql/my.cnf index 3793e8baa..ba3c25ce9 100644 --- a/dbcon/mysql/my.cnf +++ b/dbcon/mysql/my.cnf @@ -39,6 +39,8 @@ read_rnd_buffer_size = 16M myisam_sort_buffer_size = 64M thread_cache_size = 8 query_cache_size = 0 +# Disable client progress reports. More people are annoyed by it than not. +progress_report_time=0 # Try number of CPU's*2 for thread_concurrency #thread_concurrency = 8 thread_stack = 512K