Commit 7849fe87 authored by Eric Cano's avatar Eric Cano
Browse files

Fixed last memory leaks in unit test.

Added suppression lists for external libraries and old castor one-off allocations.
Enabled the memory check make test.
parent f91ef84b
......@@ -115,9 +115,10 @@ endif (${COMPILE_PACKAGING} STREQUAL "1")
#add_custom_target(test test/castorUnitTests
# COMMENT "Not running the unit tests" VERBATIM)
configure_file(tests/valgrind.suppr tests/valgrind.suppr COPYONLY)
add_custom_target(test tests/unittests
#
#COMMAND valgrind --track-fds=yes --leak-check=full --demangle=yes --gen-suppressions=all --show-reachable=yes --error-exitcode=1 tests/unittests
COMMAND valgrind --track-fds=yes --leak-check=full --demangle=yes --gen-suppressions=all --show-reachable=yes --error-exitcode=1 --suppressions=tests/valgrind.suppr tests/unittests
#COMMAND test/castorThreadedUnitTests
#COMMAND valgrind --track-fds=yes --leak-check=full --show-reachable=yes --error-exitcode=1 test/castorThreadedUnitTests
#COMMAND valgrind --tool=helgrind -v --demangle=no --conflict-cache-size=30000000 --error-exitcode=1 test/castorThreadedUnitTests
......
......@@ -294,6 +294,15 @@ void MigrationReportPacker::WorkerThread::run(){
m_parent.m_watchdog->addParameter(log::Param("status","failure"));
}
}
// Drain the FIFO if necessary. We know that m_continue will be
// set by ReportEndofSessionWithErrors or ReportEndofSession
// TODO devise a more generic mechanism
while(m_parent.m_continue) {
std::unique_ptr<Report> rep (m_parent.m_fifo.pop());
if (dynamic_cast<ReportEndofSessionWithErrors *>(rep.get()) ||
dynamic_cast<ReportEndofSession *>(rep.get()))
m_parent.m_continue = false;
}
}
}}}}
......@@ -146,7 +146,7 @@ private:
public:
ReportEndofSessionWithErrors(std::string msg,int errorCode):
m_message(msg),m_errorCode(errorCode){}
virtual void execute(MigrationReportPacker& reportPacker);
};
......
......@@ -165,12 +165,14 @@ m_parent(parent) {
void RecallReportPacker::WorkerThread::run(){
m_parent.m_lc.pushOrReplace(Param("thread", "RecallReportPacker"));
m_parent.m_lc.log(LOG_DEBUG, "Starting RecallReportPacker thread");
bool endFound = false;
try{
while(1) {
std::unique_ptr<Report> rep(m_parent.m_fifo.pop());
rep->execute(m_parent);
if(rep->goingToEnd()) {
endFound = true;
break;
}
}
......@@ -215,6 +217,14 @@ void RecallReportPacker::WorkerThread::run(){
m_parent.m_watchdog->addParameter(log::Param("status","failure"));
}
}
// Drain the fifo in case we got an exception
if (!endFound) {
while (1) {
std::unique_ptr<Report> report(m_parent.m_fifo.pop());
if (report->goingToEnd())
break;
}
}
m_parent.m_lc.log(LOG_DEBUG, "Finishing RecallReportPacker thread");
}
......
{
C__Coptind
Memcheck:Leak
fun:calloc
fun:C__Coptind
...
}
{
C__serrno
Memcheck:Leak
fun:calloc
fun:C__serrno
...
}
{
C__Copterr
Memcheck:Leak
fun:calloc
fun:C__Copterr
...
}
{
C__Coptreset
Memcheck:Leak
fun:calloc
fun:C__Coptreset
...
}
{
C__Coptopt
Memcheck:Leak
fun:calloc
fun:C__Coptopt
...
}
{
Cglobals_get
Memcheck:Leak
fun:calloc
fun:Cglobals_get
...
}
{
xrootdclient
Memcheck:Leak
fun:malloc
fun:strdup
fun:_ZN8XrdNetIF9SetDomainEv
fun:_GLOBAL__I_XrdNetIF.cc
obj:/usr/lib64/libXrdUtils.so.2.0.0
obj:/usr/lib64/libXrdUtils.so.2.0.0
}
{
C__Coptarg
Memcheck:Leak
fun:calloc
fun:C__Coptarg
...
}
{
C__serrno_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:C__serrno
...
}
{
C__rfio_errno_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:C__rfio_errno
...
}
{
C__Copterr_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:C__Copterr
...
}
{
C__Coptind_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:C__Coptind
...
}
{
C__Coptopt_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:C__Coptopt
...
}
{
C__Coptreset_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:C__Coptreset
...
}
{
C__Coptarg_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:C__Coptarg
...
}
{
Cglobals_get_thread
Memcheck:Leak
fun:malloc
fun:Cthread_Getspecific
fun:Cthread_Getspecific_init
fun:Cglobals_get
...
}
{
xrootdclient_2
Memcheck:Leak
fun:malloc
fun:strdup
fun:_ZN11XrdSysUtils8ExecNameEv
fun:_ZN5XrdCl10DefaultEnvC1Ev
fun:_ZN5XrdCl10DefaultEnv10InitializeEv
fun:_GLOBAL__I_XrdClDefaultEnv.cc
obj:/usr/lib64/libXrdCl.so.2.0.0
obj:/usr/lib64/libXrdCl.so.2.0.0
}
{
liblttng-ust
Memcheck:Leak
fun:calloc
fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5
fun:__tracepoints__ptrs_init
obj:/usr/lib64/liblttng-ust.so.0.0.0
obj:/usr/lib64/liblttng-ust.so.0.0.0
}
{
Cthread_init
Memcheck:Leak
fun:malloc
fun:_Cthread_addcid
fun:_Cthread_once
fun:pthread_once
fun:_Cthread_init
fun:Cthread_init
...
}
{
libXrdUtils
Memcheck:Leak
fun:malloc
fun:__res_vinit
fun:gaih_inet
fun:getaddrinfo
fun:_ZN10XrdNetAddr3SetEPKci
fun:_ZN10XrdNetAddrC1Ei
fun:_ZN8XrdNetIF9SetDomainEv
fun:_GLOBAL__I_XrdNetIF.cc
obj:/usr/lib64/libXrdUtils.so.2.0.0
obj:/usr/lib64/libXrdUtils.so.2.0.0
}
{
liblttng-ust_3
Memcheck:Leak
fun:malloc
fun:add_to_global
fun:dl_open_worker
fun:_dl_catch_error
fun:_dl_open
fun:dlopen_doit
fun:_dl_catch_error
fun:_dlerror_run
fun:dlopen@@GLIBC_2.2.5
fun:__tracepoints__ptrs_init
obj:/usr/lib64/liblttng-ust.so.0.0.0
obj:/usr/lib64/liblttng-ust.so.0.0.0
}
{
liblttng-ust_4
Memcheck:Leak
fun:calloc
fun:_dl_allocate_tls
fun:pthread_create@@GLIBC_2.2.5
fun:lttng_ust_init
obj:/usr/lib64/liblttng-ust.so.0.0.0
obj:/usr/lib64/liblttng-ust.so.0.0.0
}
{
liblttng-ust_5
Memcheck:Leak
fun:calloc
fun:_dl_allocate_tls
fun:pthread_create@@GLIBC_2.2.5
fun:lttng_ust_init
obj:/usr/lib64/liblttng-ust.so.0.0.0
obj:/usr/lib64/liblttng-ust.so.0.0.0
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment