今日发现http_msg_server异常,遂查看日志,发现了这么一坨东西:
2021-08-24 20:13:20.102 [ERROR] [0x7f7fe5a80820] [IM] - <HttpConn.cpp>|<178>|<Close>,erase handle:99 ,./http_msg_server(_Z13GetTraceStackv+0x2f) [0x4f766f]
./http_msg_server(_ZN9CHttpConn5CloseEv+0x36) [0x4da342]
./http_msg_server(_ZN9CHttpConn15OnWriteCompleteEv+0x18) [0x4dab76]
./http_msg_server(_ZN9CHttpConn4SendEPvi+0xc6) [0x4da306]
./http_msg_server(_ZN9CHttpConn12SendAndCloseEiPKc+0xad) [0x4e099d]
./http_msg_server(_ZN9CHttpConn24onHandleNginxHealthCheckERKSsS1_+0x8d) [0x4dda83]
./http_msg_server(_ZNKSt7_Mem_fnIM9CHttpConnFvRKSsS2_EEclIIS2_S2_EvEEvPS0_DpOT_+0x91) [0x4e9c97]
./http_msg_server(_ZNSt5_BindIFSt7_Mem_fnIM9CHttpConnFvRKSsS3_EEPS1_St12_PlaceholderILi1EES8_ILi2EEEE6__callIvJS3_S3_EJLm0ELm1ELm2EEEET_OSt5tupleIJDpT0_EESt12_Index_tupleIJXspT1_EEE+0xa0) [0x4e8c1c]
./http_msg_server(_ZNSt5_BindIFSt7_Mem_fnIM9CHttpConnFvRKSsS3_EEPS1_St12_PlaceholderILi1EES8_ILi2EEEEclIJS3_S3_EvEET0_DpOT_+0x5e) [0x4e6f0a]
./http_msg_server(_ZNSt17_Function_handlerIFvRKSsS1_ESt5_BindIFSt7_Mem_fnIM9CHttpConnFvS1_S1_EEPS5_St12_PlaceholderILi1EESA_ILi2EEEEE9_M_invokeERKSt9_Any_dataS1_S1_+0x4f) [0x4e5455]
./http_msg_server(_ZNKSt8functionIFvRKSsS1_EEclES1_S1_+0x61) [0x4e2749]
./http_msg_server(_ZN9CHttpConn6OnReadEv+0x38c) [0x4da8e2]
给我整懵了,这是崩溃了?
还是咋回事?
于是看了下代码:
void CHttpConn::Close() {
if (m_state != CONN_STATE_CLOSED) {
m_state = CONN_STATE_CLOSED;
loge("erase handle:%d ,%s", m_conn_handle, GetTraceStack().c_str());
g_http_conn_map.erase(m_conn_handle);
netlib_close(m_sock_handle);
handle_map_.clear();
ReleaseRef();
}
}
这个GetTraceStack() 看起来是打印堆栈的意思
std::string GetTraceStack()
{
static const int MAX_STACK_FRAMES = 12;
void *pStack[MAX_STACK_FRAMES];
char ** pStackList = NULL;
int frames = backtrace(pStack, MAX_STACK_FRAMES);
pStackList = backtrace_symbols(pStack, frames);
if (NULL == pStackList)
return "" ;
std::string szStackInfo;
for (int i = 0; i < frames; ++i)
{
if (NULL == pStackList[i])
break;
szStackInfo += pStackList[i];
szStackInfo += "\n";
}
return szStackInfo;
}
原理是正常的,然后通过对堆栈一分析,应该是健康检查导致http链接关闭,所以频繁的会打印这个错误。
|