qvvr has bug

This commit is contained in:
lnk
2025-05-20 16:31:12 +08:00
parent 093e8e5dd6
commit 3ad2e7c590
12 changed files with 314 additions and 44 deletions

View File

@@ -55,6 +55,11 @@ SD_CONST static ST_CHAR *SD_CONST thisFileName = __FILE__;
///////////////////////////////////////////////////////
uint32_t g_dead_lock_counter = 0;
uint32_t g_thread_blocked_times = 0;
//给mq生产线程和定时线程都加上死锁计数器
uint32_t g_mqproducer_blocked_times = 0;
uint32_t g_ontime_blocked_times = 0;
///////////////////////////////////////////////////////////////////////////////
int three_secs_enabled = 0;
int auto_register_report_enabled = 0;
@@ -225,9 +230,11 @@ int main(int argc, const char **argv)
//lnk启动进程日志
init_logger_process();
char buf[256];
sprintf(buf, "前置的%s%d号进程 进程级日志初始化完毕", get_front_msg_from_subdir(), g_front_seg_index);
log_debug("process", buf);
//char buf[256];
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 进程级日志初始化完毕", get_front_msg_from_subdir(), g_front_seg_index);
//log_debug("process", buf);
DIY_WARNLOG("process","前置的%s%d号进程 进程级日志初始化完毕", get_front_msg_from_subdir(), g_front_seg_index);
#ifdef _OS_UNIX_
#ifdef QT_NO_DEBUG
@@ -260,11 +267,19 @@ int main(int argc, const char **argv)
rv = init_rdb();
if (rv!=APR_SUCCESS){
//char buf[256];
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 台账初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
//log_error("process", buf);
DIY_ERRORLOG("process","前置的%s%d号进程 台账初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
return rv;
}
rv = run_protocol();
if (rv!=APR_SUCCESS){
//char buf[256];
//format_log_msg(buf,sizeof(buf),"前置的%s%d号进程 线程初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
//log_error("process", buf);
DIY_ERRORLOG("process","前置的%s%d号进程 线程初始化失败", get_front_msg_from_subdir(), g_front_seg_index);
return rv;
}
@@ -307,6 +322,12 @@ int main(int argc, const char **argv)
//work线程死了3*13分钟退出进程
if (g_thread_blocked_times>=13) {
MVL_LOG_ACSE0 ("MYLOG: g_thread_blocked_times>=3, so exit to restart ");
//char buf[256];
//format_log_msg(buf,sizeof(buf),"前置的业务线程死锁,退出进程");
//log_error("process", buf);
DIY_ERRORLOG("process","前置的%s%d号进程 业务线程死锁,退出进程", get_front_msg_from_subdir(), g_front_seg_index);
apr_sleep(apr_time_from_sec(10));
exit(-1039);
}
@@ -422,6 +443,8 @@ void doMonitorTaskmain(void) {
if( !(stimer++ % 60) ) {//分钟
if (g_dead_lock_counter++ >=3) {//三分钟
g_thread_blocked_times++;
g_mqproducer_blocked_times++;
g_ontime_blocked_times++;
g_dead_lock_counter = 0;
}
MVL_LOG_ACSE1 ("MYLOG: current g_thread_blocked_times = %u ", g_thread_blocked_times);
@@ -435,7 +458,7 @@ void doMonitorTaskmain(void) {
}
//work线程死了3*13分钟退出进程
if (g_thread_blocked_times>=13) {
if (g_thread_blocked_times>=13 || g_mqproducer_blocked_times>=13 || g_ontime_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);