Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 045703ef authored by Axel Auweter's avatar Axel Auweter
Browse files

First set of patches related to ticket #29

Found some memory leaks in DCDBLib and fixed
a bug related to thread handling in CollectAgent.
parent 596c4ee7
......@@ -147,7 +147,8 @@ int main(int argc, char* const argv[]) {
/*
* Allocate and initialize sensor data store.
*/
mySensorDataStore = new SensorDataStore("127.0.0.1", 9042);
std::string sdHost("127.0.0.1");
mySensorDataStore = new SensorDataStore(sdHost, 9042);
/*
* Start the MQTT Message Server.
......
......@@ -26,6 +26,8 @@
#ifndef SIMPLEMQTTSERVER_H_
#define SIMPLEMQTTSERVER_H_
//#define SimpleMQTTVerbose 100
/*
* Define the number of connections that are handled by each thread.
* If the number of clients exceeds the specified value, a new thread will be spawned.
......
......@@ -142,8 +142,21 @@ void SimpleMQTTServerAcceptThread::run()
*/
SimpleMQTTServerMessageThread *mt = NULL;
for (boost::ptr_list<SimpleMQTTServerMessageThread>::iterator i = messageThreads.begin(); i != messageThreads.end(); i++) {
if (i->hasCapacity())
mt = &*i;
if (i->hasCapacity()) {
mt = &*i;
#ifdef SimpleMQTTVerbose
coutMtx.lock();
cout << "Found a message thread with capacity: " << mt << "...\n";
coutMtx.unlock();
#endif
}
else {
#ifdef SimpleMQTTVerbose
coutMtx.lock();
cout << "No capacity in message thread: " << mt << "...\n";
coutMtx.unlock();
#endif
}
}
/*
......@@ -348,7 +361,7 @@ void SimpleMQTTServerMessageThread::run()
bool SimpleMQTTServerMessageThread::hasCapacity()
{
return numConnections <= SimpleMQTTConnectionsPerThread;
return numConnections < SimpleMQTTConnectionsPerThread;
}
void SimpleMQTTServerMessageThread::assignConnection(int newsock)
......@@ -415,6 +428,12 @@ void SimpleMQTTServerMessageThread::setMessageCallback(SimpleMQTTMessageCallback
SimpleMQTTServerMessageThread::SimpleMQTTServerMessageThread(SimpleMQTTMessageCallback callback)
{
#ifdef SimpleMQTTVerbose
coutMtx.lock();
cout << "Created new MessageThread (" << (void*)this << ")\n";
coutMtx.unlock();
#endif
/*
* Clear the fds array. Warning: This will only work when the
* size of the fds array is determined at compile time.
......
......@@ -99,6 +99,11 @@ bool CassandraBackend::connect(std::string hostname, int port)
*/
void CassandraBackend::updateSchema()
{
/* Free the memory of the currently known schema definition. */
if (schema)
cass_schema_free(schema);
/* Get the new schema */
schema = cass_session_get_schema(session);
}
......@@ -272,6 +277,8 @@ void CassandraBackend::insert(std::string key, uint64_t ts, uint64_t value)
prepared = cass_future_get_prepared(future);
}
cass_future_free(future);
statement = cass_prepared_bind(prepared);
CassBytes sid = cass_bytes_init((cass_byte_t*)(key.c_str()), 16);
......@@ -289,6 +296,7 @@ void CassandraBackend::insert(std::string key, uint64_t ts, uint64_t value)
printError(future);
}
cass_prepared_free(prepared);
cass_future_free(future);
cass_statement_free(statement);
}
......@@ -297,6 +305,7 @@ CassandraBackend::CassandraBackend()
{
cluster = nullptr;
session = nullptr;
schema = nullptr;
}
CassandraBackend::~CassandraBackend()
......@@ -306,4 +315,6 @@ CassandraBackend::~CassandraBackend()
cass_session_free(session);
if (cluster)
cass_cluster_free(cluster);
if (schema)
cass_schema_free(schema);
}
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