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

Fix resource leak in DDLProc/DMLProc/PrimProc/WriteengineServer processes.

As part of the charset support, a call to MY_INIT() was added at the
initialization of the above processes. This call initializes the MySQL
thread environment required by the charset library. However, the
accompanying my_end() call required to terminate this thread environment
was not added at the termination of these process, hence leaking
resources. As a fix, we move the MY_INIT() calls to the Child()
functions of these services and also add the missing my_end() call.
This commit is contained in:
Gagan Goel
2023-06-22 15:53:04 +00:00
parent cc08929578
commit ab7dfaa25b
4 changed files with 48 additions and 9 deletions

View File

@ -174,6 +174,9 @@ int ServiceWriteEngine::Child()
// Init WriteEngine Wrapper (including Config Columnstore.xml cache)
WriteEngine::WriteEngineWrapper::init(WriteEngine::SUBSYSTEM_ID_WE_SRV);
// Initialize the charset library
MY_INIT("WriteEngineServer");
Config weConfig;
ostringstream serverParms;
@ -221,6 +224,10 @@ int ServiceWriteEngine::Child()
logging::MessageLog ml(lid);
ml.logCriticalMessage(message);
NotifyServiceInitializationFailed();
// Free up resources allocated by MY_INIT() above.
my_end(0);
return 2;
}
}
@ -258,6 +265,10 @@ int ServiceWriteEngine::Child()
cerr << errMsg << endl;
NotifyServiceInitializationFailed();
// Free up resources allocated by MY_INIT() above.
my_end(0);
return 2;
}
@ -304,6 +315,9 @@ int ServiceWriteEngine::Child()
}
}
// Free up resources allocated by MY_INIT() above.
my_end(0);
// It is an error to reach here...
return 1;
}
@ -317,8 +331,6 @@ int main(int argc, char** argv)
setlocale(LC_NUMERIC, "C");
// This is unset due to the way we start it
program_invocation_short_name = const_cast<char*>("WriteEngineServ");
// Initialize the charset library
MY_INIT(argv[0]);
return ServiceWriteEngine(opt).Run();
}