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

MCOL-857 Fix thread leak on ByteStream exception

ByteStream::advance can throw an exception if there isn't enough data in
the buffer yet. PrimProc's BPP processor would not catch this causing a
thread to be leaked every time. This was happening on BPP destroy and
abort.
This commit is contained in:
Andrew Hutchings
2017-08-03 17:47:56 +01:00
parent 630b113565
commit d690a14eb9

View File

@ -1223,8 +1223,17 @@ struct BPPHandler
uint32_t key;
BPPMap::iterator it;
bs.advance(sizeof(ISMPacketHeader));
bs >> key;
try
{
bs.advance(sizeof(ISMPacketHeader));
bs >> key;
}
catch(...)
{
// MCOL-857 We don't have the full packet yet
bs.rewind();
return -1;
}
mutex::scoped_lock scoped(bppLock);
bppKeysIt = std::find(bppKeys.begin(), bppKeys.end(), key);
if (bppKeysIt != bppKeys.end()) {
@ -1425,10 +1434,20 @@ struct BPPHandler
uint32_t uniqueID, sessionID, stepID;
BPPMap::iterator it;
bs.advance(sizeof(ISMPacketHeader));
bs >> sessionID;
bs >> stepID;
bs >> uniqueID;
try
{
bs.advance(sizeof(ISMPacketHeader));
bs >> sessionID;
bs >> stepID;
bs >> uniqueID;
}
catch(...)
{
// MCOL-857 We don't appear to have the full packet yet!
bs.rewind();
return -1;
}
mutex::scoped_lock lk(djLock);
mutex::scoped_lock scoped(bppLock);