必须适配RuleScan 2016_10_21以上版本。

避免在销毁rulescan句柄后,在rulescan_endstream时的段错误。
This commit is contained in:
zhengchao
2016-10-21 16:42:04 +08:00
parent 2a0c7738e3
commit 4d17254a7e
5 changed files with 28 additions and 7 deletions

View File

@@ -1297,10 +1297,15 @@ void Maat_stream_scan_string_end(stream_para_t* stream_para)
if(sp->version==sp->feather->maat_version) if(sp->version==sp->feather->maat_version)
{ {
DEC_SCANNER_REF(scanner, sp->thread_num); DEC_SCANNER_REF(scanner, sp->thread_num);
}
rulescan_endstream(sp->rs_stream_para); rulescan_endstream(sp->rs_stream_para);
}
else
{
rulescan_endstream_simple(sp->rs_stream_para);
sp->feather->zombie_rs_stream--;
}
} }
if(sp->last_cache!=NULL) if(sp->last_cache!=NULL)
{ {

View File

@@ -26,7 +26,7 @@
#include "mesa_fuzzy.h" #include "mesa_fuzzy.h"
#include "great_index_engine.h" #include "great_index_engine.h"
int MAAT_FRAME_VERSION_1_8_20161008=1; int MAAT_FRAME_VERSION_1_8_20161021_zombie_stream=1;
const char *maat_module="MAAT Frame"; const char *maat_module="MAAT Frame";
const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin", const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin",
@@ -2484,7 +2484,6 @@ void garbage_bury(MESA_lqueue_head garbage_q,void *logger)
break; break;
case GARBAGE_SCANNER: case GARBAGE_SCANNER:
ref_cnt=aligment_int64_array_sum(bag->scanner->ref_cnt,bag->scanner->max_thread_num); ref_cnt=aligment_int64_array_sum(bag->scanner->ref_cnt,bag->scanner->max_thread_num);
if(ref_cnt==0) if(ref_cnt==0)
{ {
MESA_handle_runtime_log(logger,RLOG_LV_INFO,maat_module, MESA_handle_runtime_log(logger,RLOG_LV_INFO,maat_module,
@@ -2795,6 +2794,7 @@ void *thread_rule_monitor(void *arg)
{ {
assert(feather->scanner->version>old_scanner->version); assert(feather->scanner->version>old_scanner->version);
assert(old_scanner->tomb_ref==feather->garbage_q); assert(old_scanner->tomb_ref==feather->garbage_q);
feather->zombie_rs_stream+=aligment_int64_array_sum(old_scanner->ref_cnt,old_scanner->max_thread_num);
garbage_bagging(GARBAGE_SCANNER, old_scanner, feather->garbage_q); garbage_bagging(GARBAGE_SCANNER, old_scanner, feather->garbage_q);
} }
feather->update_tmp_scanner=NULL; feather->update_tmp_scanner=NULL;

View File

@@ -365,6 +365,7 @@ struct _Maat_feather_t
long long update_err_cnt;//sum of the same name variable in each table long long update_err_cnt;//sum of the same name variable in each table
long long iconv_err_cnt;//sum of the same name variable in each table long long iconv_err_cnt;//sum of the same name variable in each table
long long scan_err_cnt; long long scan_err_cnt;
long long zombie_rs_stream;
}; };
struct _maat_garbage_t struct _maat_garbage_t
{ {

View File

@@ -13,7 +13,8 @@ enum MAAT_FS_STATUS{
STATUS_TOTAL_SCAN_CNT, STATUS_TOTAL_SCAN_CNT,
STATUS_UPDATE_ERR_CNT, STATUS_UPDATE_ERR_CNT,
STATUS_ICONV_ERR_CNT, STATUS_ICONV_ERR_CNT,
STATUS_SCAN_ERR_CNT STATUS_SCAN_ERR_CNT,
STATUS_ZOMBIE_RS_STREAM
}; };
enum MAAT_FS_COLUMN enum MAAT_FS_COLUMN
@@ -52,6 +53,8 @@ void maat_stat_init(struct _Maat_feather_t* feather)
feather->fs_status_id[STATUS_UPDATE_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"update_error"); feather->fs_status_id[STATUS_UPDATE_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"update_error");
feather->fs_status_id[STATUS_ICONV_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"iconv_error"); feather->fs_status_id[STATUS_ICONV_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"iconv_error");
feather->fs_status_id[STATUS_SCAN_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"scan_error"); feather->fs_status_id[STATUS_SCAN_ERR_CNT]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"scan_error");
feather->fs_status_id[STATUS_ZOMBIE_RS_STREAM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"zombie_stream");
feather->fs_column_id[COLUMN_TABLE_RULE_NUM]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_CURRENT,"rule"); feather->fs_column_id[COLUMN_TABLE_RULE_NUM]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_CURRENT,"rule");
feather->fs_column_id[COLUMN_TABLE_REGEX_NUM]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_CURRENT,"regex"); feather->fs_column_id[COLUMN_TABLE_REGEX_NUM]=FS_register(feather->stat_handle, FS_STYLE_COLUMN, FS_CALC_CURRENT,"regex");
@@ -277,6 +280,7 @@ void maat_stat_output(struct _Maat_feather_t* feather)
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_UPDATE_ERR_CNT], 0,FS_OP_SET,feather->update_err_cnt); FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_UPDATE_ERR_CNT], 0,FS_OP_SET,feather->update_err_cnt);
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_ICONV_ERR_CNT], 0,FS_OP_SET,feather->iconv_err_cnt); FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_ICONV_ERR_CNT], 0,FS_OP_SET,feather->iconv_err_cnt);
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_SCAN_ERR_CNT], 0,FS_OP_SET,feather->scan_err_cnt); FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_SCAN_ERR_CNT], 0,FS_OP_SET,feather->scan_err_cnt);
FS_operate(feather->stat_handle, feather->fs_status_id[STATUS_ZOMBIE_RS_STREAM], 0,FS_OP_SET,feather->zombie_rs_stream);
FS_passive_output(feather->stat_handle); FS_passive_output(feather->stat_handle);
return; return;

View File

@@ -188,7 +188,7 @@ extern "C"
unsigned int length[MAX_MATCH_POS_NUM]; /* <20>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еģ<D0B5><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>Ӧ<EFBFBD><D3A6>length=0, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0*/ unsigned int length[MAX_MATCH_POS_NUM]; /* <20>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD>ij<EFBFBD><C4B3>ȣ<EFBFBD><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еģ<D0B5><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>Ӧ<EFBFBD><D3A6>length=0, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><EFBFBD><E0A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0*/
}rule_result_t; }rule_result_t;
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */ /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>quickģʽ<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>expr_id<EFBFBD>Լ<EFBFBD>tag<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч */
typedef struct _scan_result_t typedef struct _scan_result_t
{ {
unsigned int expr_id; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ID */ unsigned int expr_id; /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ID */
@@ -280,7 +280,8 @@ extern "C"
int rulescan_computeresult(void * stream_param, scan_result_t * presults, unsigned int size); int rulescan_computeresult(void * stream_param, scan_result_t * presults, unsigned int size);
/* /*
<09><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽɨ<CABD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽɨ<CABD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><EFBFBD>øýӿ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><EFBFBD>֮ǰ<EFBFBD><EFBFBD>û<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>
rulescan_destroy<6F><79><EFBFBD><EFBFBD>rulescan<61><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
stream_param [in]: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD> stream_param [in]: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>
<09><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5> <09><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
@@ -288,6 +289,16 @@ extern "C"
*/ */
void rulescan_endstream(void * stream_param); void rulescan_endstream(void * stream_param);
/*
<09><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽɨ<CABD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>rulescan_destroy<6F><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>rulescan<61><6E><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>ٽ<EFBFBD><D9BD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
<20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>rulescan_endstream_simple<6C><65><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²ŵ<C2B2><C5B5>øýӿڡ<D3BF>
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
stream_param [in]: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD>
<09><><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>
<09>ޡ<EFBFBD>
*/
void rulescan_endstream_simple(void * stream_param);
/* /*
<09><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ʽɨ<CABD><C9A8><EFBFBD>ӿڣ<D3BF>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󷵻<EFBFBD><F3B7B5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD><EFBFBD>ʽɨ<CABD><C9A8><EFBFBD>ӿڣ<D3BF>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>󷵻<EFBFBD><F3B7B5BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>н<EFBFBD><D0BD><EFBFBD><EFBFBD><EFBFBD>
<09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>