Commit b2c23fd2 authored by Dainius Simelevicius's avatar Dainius Simelevicius
Browse files

references #264: elastic::timestream should release memory blocks when it is disabled

parent bf5b21d4
// $Id$
/*************************************************************************
* XDAQ Components for Distributed Data Acquisition *
* Copyright (C) 2000-2018, CERN. *
* Copyright (C) 2000-2021, CERN. *
* All rights reserved. *
* Authors:L. Orsini, P. Roberts, D. Simelevicius *
* *
......@@ -18,7 +16,7 @@
#define WORKSUITE_ELASTICTIMESTREAM_VERSION_MAJOR 2
#define WORKSUITE_ELASTICTIMESTREAM_VERSION_MINOR 4
#define WORKSUITE_ELASTICTIMESTREAM_VERSION_PATCH 0
#define WORKSUITE_ELASTICTIMESTREAM_VERSION_PATCH 1
// If any previous versions available E.g. #define WORKSUITE_ELASTICTIMESTREAM_PREVIOUS_VERSIONS ""
#undef WORKSUITE_ELASTICTIMESTREAM_PREVIOUS_VERSIONS
......
......@@ -400,12 +400,17 @@ void elastic::timestream::Application::timeExpired(toolbox::task::TimerEvent& e)
void elastic::timestream::Application::onMessage(toolbox::mem::Reference* ref, xdata::Properties& plist)
{
// some protections
if (enable_ == false)
if (ref == 0)
{
return;
}
if (ref == 0)
// some protections
if (enable_ == false)
{
ref->release();
return;
}
std::string qname = plist.getProperty("urn:xmas-flashlist:name");
......@@ -426,7 +431,6 @@ void elastic::timestream::Application::onMessage(toolbox::mem::Reference* ref, x
return;
}
toolbox::mem::Reference * localRef;
if (spoolerPool_->isHighThresholdExceeded())
......@@ -482,7 +486,6 @@ void elastic::timestream::Application::onMessage(toolbox::mem::Reference* ref, x
return;
}
elastic::timestream::Event * ep = new elastic::timestream::Event(plist, localRef);
toolbox::task::EventReference e(ep);
......@@ -507,12 +510,10 @@ void elastic::timestream::Application::onMessage(toolbox::mem::Reference* ref, x
}
catch(toolbox::task::exception::InternalError& e)
{
// we do not know what happen to this reference, therefore we cannot free , this reference can be considered lost
//localRef->release();
localRef->release();
statistics_[qname].lossQueueFullCounter++;
std::stringstream msg;
msg << "Failed to dispatch event report for flashlist '" << qname << "' , a memory reference can be lost";
std::stringstream msg;
msg << "Failed to dispatch event report for flashlist '" << qname << "'";
XCEPT_DECLARE_NESTED(elastic::timestream::exception::Exception, q, msg.str(), e);
this->notifyQualified("fatal", q);
}
......
Markdown is supported
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