diff --git a/scripts/base/frameworks/sumstats/cluster.bro b/scripts/base/frameworks/sumstats/cluster.bro index 73cbfe3cd3..6c72d5ff17 100644 --- a/scripts/base/frameworks/sumstats/cluster.bro +++ b/scripts/base/frameworks/sumstats/cluster.bro @@ -269,8 +269,7 @@ event SumStats::finish_epoch(ss: SumStat) event SumStats::cluster_ss_request(uid, ss$name, T); done_with[uid] = 0; - reset(ss); - + #print fmt("get_key by uid: %s", uid); event SumStats::get_a_key(uid, ss$name, T); } @@ -292,6 +291,12 @@ function data_added(ss: SumStat, key: Key, result: Result) function handle_end_of_result_collection(uid: string, ss_name: string, key: Key, cleanup: bool) { + if ( uid !in key_requests ) + { + Reporter::warning(fmt("Tried to handle end of result collection with missing uid in key_request sumstat:%s, key:%s.", ss_name, key)); + return; + } + #print fmt("worker_count:%d :: done_with:%d", Cluster::worker_count, done_with[uid]); local ss = stats_store[ss_name]; local ir = key_requests[uid]; @@ -376,6 +381,8 @@ event SumStats::send_no_key(uid: string, ss_name: string) local ss = stats_store[ss_name]; if ( ss?$epoch_finished ) ss$epoch_finished(network_time()); + + reset(ss); } } } @@ -410,6 +417,8 @@ event SumStats::send_a_key(uid: string, ss_name: string, key: Key) local ss = stats_store[ss_name]; if ( ss?$epoch_finished ) ss$epoch_finished(network_time()); + + reset(ss); } } } @@ -430,6 +439,7 @@ event SumStats::cluster_send_result(uid: string, ss_name: string, key: Key, resu if ( uid !in done_with ) done_with[uid] = 0; + #print fmt("MANAGER: got a result for %s %s from %s", uid, key, get_event_peer()$descr); ++done_with[uid]; #if ( Cluster::worker_count == done_with[uid] ) @@ -443,7 +453,7 @@ event SumStats::cluster_send_result(uid: string, ss_name: string, key: Key, resu event SumStats::cluster_key_intermediate_response(ss_name: string, key: Key) { #print fmt("MANAGER: receiving intermediate key data from %s", get_event_peer()$descr); - #print fmt("MANAGER: requesting key data for %s", key2str(key)); + #print fmt("MANAGER: requesting key data for %s", key); if ( ss_name in outstanding_global_views && |outstanding_global_views[ss_name]| > max_outstanding_global_views ) @@ -458,9 +468,11 @@ event SumStats::cluster_key_intermediate_response(ss_name: string, key: Key) local uid = unique_id(""); done_with[uid] = 0; + #print fmt("requesting results for: %s", uid); event SumStats::cluster_get_result(uid, ss_name, key, F); when ( uid in done_with && Cluster::worker_count == done_with[uid] ) { + #print fmt("workers: %d done: %d", Cluster::worker_count, done_with[uid]); handle_end_of_result_collection(uid, ss_name, key, F); } timeout 1.1min