fix bug in log upload

This commit is contained in:
lnk
2025-03-04 17:29:04 +08:00
parent 87f0a48ad7
commit 1df5385fc9
16 changed files with 434 additions and 80 deletions

View File

@@ -17,7 +17,6 @@
#include "apr_time.h"
#include <stdbool.h>//lnk20241022
#include "../cfg_parse/custom_printf.h"//lnk20250225
#define LOG_IDX (0)
#define RPT_IDX (1)

View File

@@ -17,6 +17,9 @@
/*lnk10-10 */
#include "../include/rocketmq/SimpleProducer.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
extern G_TEST_FLAG;
extern pthread_mutex_t mtx;
@@ -35,6 +38,8 @@ uint32_t g_node_id = 0;
uint32_t g_min_free_size = 1024;
int g_need_password = 0;
int INITFLAG = 0; //lnk20250304
char subdir[128] = "cfg_stat_data" ;
int usage();
@@ -276,26 +281,34 @@ int main(int argc, const char **argv)
}
//lnk20241024ȥ<34><C8A5><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>
//OTLConnect();
//OTLConnect();
rv = run_protocol();
if (rv!=APR_SUCCESS){
return rv;
}
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD>־,<2C><>ֹ<EFBFBD><D6B9>δ׼<CEB4><D7BC><EFBFBD><EFBFBD>ȫ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><C2B1><EFBFBD>
INITFLAG = 1;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("INITFLAG=%d\n",INITFLAG);
if (1 == G_TEST_FLAG) {
//lnk<6E><6B><EFBFBD><EFBFBD>mqģ<71><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>ֻ<EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
printf("try_start_mqtest_thread \n");
int ret = try_start_mqtest_thread(0,NULL);
// <20>ȴ<EFBFBD><C8B4>߳<EFBFBD><DFB3>˳<EFBFBD>
echo_warn1("%-60s","System shutdown now......");
apr_pool_destroy(g_root_pool);
echo_msg("OK\n");
return ret;
}
while(1) {
/* sleep 1s, just like 1s timer */
apr_sleep(apr_time_from_sec(1));
/* ÿ30<33><30><EFBFBD>Ӽ<EFBFBD><D3BC><EFBFBD>һ<EFBFBD><D2BB>״̬ */
/*<2A><><EFBFBD><EFBFBD>mq<6D><71><EFBFBD><EFBFBD>lnk10-10 */
//rocketmq_test_rt();
//rocketmq_test_ud();
//rocketmq_test_rc();
/*lnk20241029recall<6C>ӿڲ<D3BF><DAB2><EFBFBD>*/
//curltest();
/*202411-1lnk<6E><6B><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD> */
//SOEFileWeb_test();
//<2F><><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD><EFBFBD>
@@ -327,14 +340,14 @@ int main(int argc, const char **argv)
}
//lnk20241211 <20><><EFBFBD>Ӳ<EFBFBD><D3B2>Կ<EFBFBD><D4BF><EFBFBD>
pthread_mutex_lock(&mtx); printf("main thread hold lock !!!!!!!!!!!");
pthread_mutex_lock(&mtx);
if (!G_TEST_FLAG && g_front_num_count >= 30 && g_onlyIP[0] == 0 && g_node->n_clients>10) {//30<33><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD>˴<EFBFBD><CBB4><EFBFBD>ʮ<EFBFBD><CAAE><EFBFBD>ն<EFBFBD>
MVL_LOG_ACSE0("MYLOG: g_front_num_count>=20, so exit to restart ");
apr_sleep(apr_time_from_sec(10));
exit(-1039);
}
pthread_mutex_unlock(&mtx); printf("main thread free lock !!!!!!!!!!!");
pthread_mutex_unlock(&mtx);
}
@@ -455,3 +468,41 @@ int parse_param(int argc, const char **argv)
}
///////////////////////////////////////////////////////////////<2F><><EFBFBD>Ӳ<EFBFBD><D3B2>Խ<EFBFBD><D4BD>̵ļ<CCB5><C4BC>غ<EFBFBD><D8BA><EFBFBD>lnk20250304
void doMonitorTaskmain(void) {
static int stimer = 0;
stimer++;
if( !(stimer++ % 60) ) {//<2F><><EFBFBD><EFBFBD>
if (g_dead_lock_counter++ >=3) {//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
g_thread_blocked_times++;
g_dead_lock_counter = 0;
}
MVL_LOG_ACSE1 ("MYLOG: current g_thread_blocked_times = %u ", g_thread_blocked_times);
if (FRONT_MP_NUM <= 1) {//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
g_front_num_count++;
}
else {
g_front_num_count = 0;
}
}
//work<72>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD>3*13<31><33><EFBFBD>ӣ<EFBFBD><D3A3>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD>
if (g_thread_blocked_times>=13) {
MVL_LOG_ACSE0 ("MYLOG: g_thread_blocked_times>=3, so exit to restart ");
apr_sleep(apr_time_from_sec(10));
exit(-1039);
}
//lnk20241211 <20><><EFBFBD>Ӳ<EFBFBD><D3B2>Կ<EFBFBD><D4BF><EFBFBD>
pthread_mutex_lock(&mtx);
if (!G_TEST_FLAG && g_front_num_count >= 30 && g_onlyIP[0] == 0 && g_node->n_clients>10) {//30<33><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD>˴<EFBFBD><CBB4><EFBFBD>ʮ<EFBFBD><CAAE><EFBFBD>ն<EFBFBD>
MVL_LOG_ACSE0("MYLOG: g_front_num_count>=20, so exit to restart ");
apr_sleep(apr_time_from_sec(10));
exit(-1039);
}
pthread_mutex_unlock(&mtx);
}

View File

@@ -21,6 +21,7 @@
#include "ied.h"
#include "../json/mms_json_inter.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
void clear_rpt_counter_by_trigger(trigger_t *trigger);

View File

@@ -38,6 +38,7 @@
#include "tp4.h"
#include "db_interface.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
/************************************************************************/
/* For debug version, use a static pointer to avoid duplication of */
/* __FILE__ strings. */

View File

@@ -56,6 +56,7 @@
#include "rdb_client.h"
#include "db_interface.h"
#include "../json/mms_json_inter.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
/************************************************************************/
/* For debug version, use a static pointer to avoid duplication of */
/* __FILE__ strings. */

View File

@@ -79,7 +79,7 @@
#include "../mms/db_interface.h"
#include <ctype.h> //lnk20241119
#include "../cfg_parse/custom_printf.h"//lnk20250225
extern uint32_t g_node_id;
extern char subdir[128];
unsigned int g_no_auth = 0;
@@ -1176,8 +1176,7 @@ S_SEC_ENCRYPT_CTRL *encryptCtrl = NULL; /* conn enctryption info */
//lnk20241119<31><39><EFBFBD><EFBFBD><EFBFBD>жϺʹ<CFBA>ӡ<EFBFBD><D3A1>ȷ<EFBFBD><C8B7>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԿΪ<D4BF><CEAA>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD>
if (!is_empty_or_whitespace(dev_series) || !is_empty_or_whitespace(dev_key)) {
printf("dev_series= %s\n", dev_series);
printf("dev_key= %s\n", dev_key);
printf("dev_series= %s,dev_key= %s\n", dev_series,dev_key);
/* Fill out an authentication structure */
authInfo = &authInfoStr;
authInfo->auth_pres = SD_TRUE;

View File

@@ -195,7 +195,7 @@
#include "mvl_log.h"
#include "mloguser.h"
#include "mmsop_en.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
#if defined(MAP30_ACSE)
#include "suicacse.h"

View File

@@ -12,7 +12,7 @@
#include <string.h>
#include "rdb_client.h"
#include "xmltools.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
//int comtrade_remain_file_num = 2147483647;
int comtrade_remain_file_num = 0;

View File

@@ -24,6 +24,7 @@ extern int g_front_seg_index;
extern int g_front_seg_num;
#include "../include/rocketmq/SimpleProducer.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
////////////////////////////////////////////
#ifdef DEBUG_SISCO
SD_CONST static ST_CHAR* SD_CONST thisFileName = __FILE__;
@@ -289,7 +290,7 @@ apr_status_t run_protocol()
{
printf("g_onlyIP[0] != 0!\n\a");
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD><EFBFBD><EFBFBD>socket<65><74>http<74><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̲<EFBFBD><CCB2><EFBFBD><EFBFBD><EFBFBD>socket<65><74>http<74>߳<EFBFBD>
}
else //socket<65><74>http<74><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̵߳Ŀ<CCB5><C4BF><EFBFBD>
@@ -362,11 +363,7 @@ apr_status_t run_protocol()
//lnk20241029<32><39><EFBFBD><EFBFBD>http<74>߳<EFBFBD>///////////////////////////////////////////////////////////////////////////////////////////////////
}
if (1 == G_TEST_FLAG) {
//lnk<6E><6B><EFBFBD><EFBFBD>mqģ<71><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
printf("try_start_mqtest_thread \n");
try_start_mqtest_thread(0,NULL);
}
}
//lnkɾ<6B><C9BE><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF>߳<EFBFBD>
@@ -382,10 +379,6 @@ apr_status_t run_protocol()
printf("try_start_ontimer_thread \n");
try_start_ontimer_thread();
//OTLTestSelect();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>
///////////////////WW end
return APR_SUCCESS;
}

View File

@@ -13,6 +13,7 @@
#include "rdb_client.h"
#include "xmltools.h"
#include "db_interface.h"
#include "../cfg_parse/custom_printf.h"//lnk20250225
//extern rdb_t* g_rdb ;
extern node_t* g_node ;
extern char g_my_conf_fname[256];