Merge remote-tracking branch 'origin/topic/jsiwek/bit-1885'

* origin/topic/jsiwek/bit-1885:
  BIT-1885: fix input framework memory leak
  Increase timeout for a memleak test
This commit is contained in:
Robin Sommer 2018-08-23 15:53:16 +00:00
commit 45338b1942
6 changed files with 28 additions and 4 deletions

View file

@ -1,4 +1,12 @@
2.5-897 | 2018-08-23 15:53:16 +0000
* BIT-1885: Fix input framework memory leak. For input threads that
get joined during run-time, messages could remain in the thread's
queue and leak. (Jon Siwek, Corelight)
* Increase timeout for a memleak test. (Jon Siwek, Corelight)
2.5-894 | 2018-08-22 12:05:19 -0500
* Ensure external test repo hashes track origin/master (Jon Siwek, Corelight)

View file

@ -1 +1 @@
2.5-894
2.5-897

View file

@ -160,6 +160,7 @@ void Manager::Process()
for ( all_thread_list::iterator i = to_delete.begin(); i != to_delete.end(); i++ )
{
BasicThread* t = *i;
t->WaitForStop();
all_threads.remove(t);

View file

@ -21,6 +21,8 @@ public:
network_time(network_time) { }
virtual bool Process() {
if ( Object()->child_finished )
return true;
bool result = Object()->OnFinish(network_time);
Object()->Finished();
return result;
@ -90,7 +92,19 @@ public:
KillMeMessage(MsgThread* thread)
: OutputMessage<MsgThread>("ReporterMessage", thread) {}
virtual bool Process() { thread_mgr->KillThread(Object()); return true; }
virtual bool Process()
{
auto rval = true;
if ( ! Object()->child_finished )
{
rval = Object()->OnFinish(network_time);
Object()->Finished();
}
thread_mgr->KillThread(Object());
return rval;
}
};
#ifdef DEBUG

View file

@ -181,6 +181,7 @@ protected:
friend class HeartbeatMessage;
friend class FinishMessage;
friend class FinishedMessage;
friend class KillMeMessage;
/**
* Pops a message sent by the child from the child-to-main queue.

View file

@ -6,9 +6,9 @@
#
# @TEST-EXEC: cp input1.log input.log
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro bro -m -b %INPUT
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 8 || (btest-bg-wait -k 1 && false)
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got2 60 || (btest-bg-wait -k 1 && false)
# @TEST-EXEC: cat input2.log >> input.log
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got6 8 || (btest-bg-wait -k 1 && false)
# @TEST-EXEC: $SCRIPTS/wait-for-file bro/got6 15 || (btest-bg-wait -k 1 && false)
# @TEST-EXEC: cat input3.log >> input.log
# @TEST-EXEC: btest-bg-wait 60