diff --git a/servant/libservant/AdminServant.cpp b/servant/libservant/AdminServant.cpp index 4eb2ad47..c6911141 100644 --- a/servant/libservant/AdminServant.cpp +++ b/servant/libservant/AdminServant.cpp @@ -40,6 +40,8 @@ void AdminServant::destroy() void AdminServant::shutdown(TarsCurrentPtr current) { + TLOGERROR("[TARS][AdminServant::shutdown]" << endl); + #if TARGET_PLATFORM_WINDOWS HANDLE hProcess = ::OpenProcess(PROCESS_ALL_ACCESS, FALSE, GetCurrentProcessId()); if (hProcess == NULL) @@ -50,7 +52,7 @@ void AdminServant::shutdown(TarsCurrentPtr current) ::TerminateProcess(hProcess, 0); #else kill(getpid(), SIGINT); //通过给自己发信号的方式结束, 避免处理线程结束时自己join自己 - // Application::terminate(); +// Application::terminate(); #endif } diff --git a/servant/libservant/Application.cpp b/servant/libservant/Application.cpp index 81bb4af9..a9a83319 100644 --- a/servant/libservant/Application.cpp +++ b/servant/libservant/Application.cpp @@ -47,11 +47,14 @@ namespace tars #if TARGET_PLATFORM_LINUX || TARGET_PLATFORM_IOS static void sighandler( int sig_no ) { + TLOGERROR("[TARS][sighandler] sig_no :" << sig_no << endl); + Application::terminate(); } #else static BOOL WINAPI HandlerRoutine(DWORD dwCtrlType) { + TLOGERROR("[TARS][sighandler] sig_no :" << sig_no << endl); Application::terminate(); ExitProcess(0); return TRUE; diff --git a/servant/libservant/AuthLogic.cpp b/servant/libservant/AuthLogic.cpp index fb1d3000..9907cda1 100644 --- a/servant/libservant/AuthLogic.cpp +++ b/servant/libservant/AuthLogic.cpp @@ -39,7 +39,7 @@ bool processAuth(TC_EpollServer::Connection *conn, const shared_ptrgetEndpoint().getAuthType(); if (type == AUTH_TYPENONE) { - adapter->getEpollServer()->info("[TARS]processAuth no need auth func, auth succ"); + adapter->getEpollServer()->info("processAuth no need auth func, auth succ"); conn->_authState = AUTH_SUCC; return false; } @@ -59,7 +59,7 @@ bool processAuth(TC_EpollServer::Connection *conn, const shared_ptrgetEpollServer()->error("[TARS]processAuth tars protocol decode error, close connection."); + adapter->getEpollServer()->error("processAuth tars protocol decode error, close connection."); conn->setClose(); return true; diff --git a/servant/libservant/ServantHandle.cpp b/servant/libservant/ServantHandle.cpp index b07f3ec1..145acd08 100644 --- a/servant/libservant/ServantHandle.cpp +++ b/servant/libservant/ServantHandle.cpp @@ -348,8 +348,13 @@ void ServantHandle::initialize() } else { - TLOGERROR("[TAF]ServantHandle initialize createServant ret null, for adapter `" +_bindAdapter->getName() + "`" << endl); - cerr << "[TAF]ServantHandle initialize createServant ret null, for adapter `" +_bindAdapter->getName() + "`" << endl; + TLOGERROR("[TARS]ServantHandle initialize createServant ret null, for adapter `" +_bindAdapter->getName() + "`" << endl); + cerr << "[TARS]ServantHandle initialize createServant ret null, for adapter `" +_bindAdapter->getName() + "`" << endl; + + TarsRemoteNotify::getInstance()->report("initialize createServant error: no adapter:" + _bindAdapter->getName()); + + TC_Common::msleep(100); + exit(-1); } @@ -361,6 +366,8 @@ void ServantHandle::initialize() TarsRemoteNotify::getInstance()->report("initialize error: no servant exists."); + TC_Common::msleep(100); + exit(-1); } @@ -380,15 +387,19 @@ void ServantHandle::initialize() TarsRemoteNotify::getInstance()->report("initialize error:" + string(ex.what())); - exit(-1); + TC_Common::msleep(100); + + exit(-1); } catch(...) { TLOGERROR("[TARS]initialize unknown exception error" << endl); - TarsRemoteNotify::getInstance()->report("initialize error"); + TarsRemoteNotify::getInstance()->report("initialize unknown exception error"); + + TC_Common::msleep(100); - exit(-1); + exit(-1); } ++it; } @@ -404,7 +415,9 @@ void ServantHandle::heartbeat() TARS_KEEPALIVE(_bindAdapter->getName()); - //上报连接数 比率 +// TLOGERROR("[TARS]ServantHandle::handle heartbeat:" << _bindAdapter->getName() << endl); + + //上报连接数 比率 if (_bindAdapter->_pReportConRate) { _bindAdapter->_pReportConRate->report((int)(_bindAdapter->getNowConnection() * 1000 / _bindAdapter->getMaxConns())); diff --git a/servant/makefile/tars-tools.cmake b/servant/makefile/tars-tools.cmake index 63562a22..4c1b0115 100644 --- a/servant/makefile/tars-tools.cmake +++ b/servant/makefile/tars-tools.cmake @@ -56,6 +56,8 @@ IF (TARS_WEB_HOST STREQUAL "") set(TARS_WEB_HOST "http://web.tars.com") ENDIF () +set(TARS_TOKEN "" CACHE STRING "set web token") + set(PLATFORM) IF (UNIX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") @@ -180,8 +182,8 @@ macro(gen_server APP TARGET) FILE(APPEND ${RUN_UPLOAD_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${TARS_PATH}\\cpp\\\\script\\\\WinSCP.exe sftp://${TARS_WEB_SERVER}/usr/local/app/patchs/tars.upload/ /upload ${APP}.${TARGET}.tgz)\n") FILE(APPEND ${RUN_UPLOAD_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${TARS_PATH}\\cpp\\\\script\\\\busybox.exe wget -O ${APP}.${TARGET}.wget.out http://${TARS_WEB_HOST}/doUpload.jsp?SERVER=${APP}.${TARGET}&TGZ=/usr/local/app/patchs/tars.upload/${APP}.${TARGET}.tgz)\n") ELSE() - FILE(WRITE ${RUN_UPLOAD_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND echo ${TARS_WEB_HOST}/pages/server/api/upload_and_publish -Fsuse=@${TARGET}.tgz -Fapplication=${APP} -Fmodule_name=${TARGET} -Fcomment=dev)\n") - FILE(APPEND ${RUN_UPLOAD_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND curl ${TARS_WEB_HOST}/pages/server/api/upload_and_publish -Fsuse=@${TARGET}.tgz -Fapplication=${APP} -Fmodule_name=${TARGET} -Fcomment=dev)\n") + FILE(WRITE ${RUN_UPLOAD_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND echo ${TARS_WEB_HOST}/api/upload_and_publish -Fsuse=@${TARGET}.tgz -Fapplication=${APP} -Fmodule_name=${TARGET} -Fcomment=developer-auto-upload)\n") + FILE(APPEND ${RUN_UPLOAD_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND curl ${TARS_WEB_HOST}/api/upload_and_publish?ticket=${TARS_TOKEN} -Fsuse=@${TARGET}.tgz -Fapplication=${APP} -Fmodule_name=${TARGET} -Fcomment=developer-auto-upload)\n") FILE(APPEND ${RUN_UPLOAD_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND echo \n---------------------------------------------------------------------------)\n") ENDIF() @@ -254,5 +256,6 @@ message("TARS_MYSQL: ${TARS_MYSQL}") message("TARS_HTTP2: ${TARS_HTTP2}") message("TARS_SSL: ${TARS_SSL}") message("TARS_WEB_HOST: ${TARS_WEB_HOST}") +message("TARS_TOKEN: ${TARS_TOKEN}") message("-------------------------------------------------------------------------------------")