提交 f46f1293 编写于 作者: O obdev 提交者: wangzelin.wzl

[CP] [CP] fix: for tenant worker, catch exception outside process_one()

上级 52e5b99c
......@@ -29,21 +29,16 @@ RLOCAL(bool, in_try_stmt);
void right_to_die_or_duty_to_live()
{
const ObFatalErrExtraInfoGuard *extra_info = ObFatalErrExtraInfoGuard::get_thd_local_val_ptr();
BACKTRACE(
ERROR, true, "Trying so hard to die, extra_info=(%s)", (NULL == extra_info) ? NULL : to_cstring(*extra_info));
#ifdef FATAL_ERROR_HANG
while (true) {
sleep(120);
}
#else
if (in_try_stmt) {
throw OB_EXCEPTION<OB_ERR_UNEXPECTED>();
} else {
while (true) {
sleep(5);
BACKTRACE(
ERROR, true, "Trying so hard to die, extra_info=(%s)", (NULL == extra_info) ? NULL : to_cstring(*extra_info));
#ifndef FATAL_ERROR_HANG
if (in_try_stmt) {
throw OB_EXCEPTION<OB_ERR_UNEXPECTED>();
}
}
#endif
sleep(60);
}
}
} // namespace common
......
......@@ -25,6 +25,7 @@
#include "rpc/frame/ob_req_processor.h"
#include "share/config/ob_server_config.h"
#include "observer/omt/ob_th_worker.h"
#include "lib/utility/ob_hang_fatal_error.h"
using namespace oceanbase::common;
using namespace oceanbase::omt;
......@@ -122,8 +123,15 @@ int ObWorkerProcessor::process(rpc::ObRequest& req)
// int64_t st = ::oceanbase::common::ObTimeUtility::current_time();
// PROFILE_LOG(DEBUG, HANDLE_PACKET_START_TIME PCODE, st, packet->get_pcode());
// go!
if (OB_FAIL(process_one(req, process_ret))) {
LOG_WARN("process request fail", K(ret));
try {
in_try_stmt = true;
if (OB_FAIL(process_one(req, process_ret))) {
LOG_WARN("process request fail", K(ret));
}
in_try_stmt = false;
} catch (OB_BASE_EXCEPTION &except) {
_LOG_ERROR("Exception caught!!! errno = %d, exception info = %s", except.get_errno(), except.what());
in_try_stmt = false;
}
// cleanup
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册