diff --git a/include/util/tlog.h b/include/util/tlog.h index e6ef7f388ff7af4bab6c29a8a62d39d01d31f256..e256d2a6ccfb067db4140c77929dd6a84c8ceafd 100644 --- a/include/util/tlog.h +++ b/include/util/tlog.h @@ -87,6 +87,8 @@ bool taosAssert(bool condition, const char *file, int32_t line, const char *form #define ASSERTS(condition, ...) taosAssert(condition, __FILE__, __LINE__, __VA_ARGS__) #define ASSERT(condition) ASSERTS(condition, "assert info not provided") +void taosCrash(int signum, void *sigInfo, void *context); + // clang-format off #define uFatal(...) { if (uDebugFlag & DEBUG_FATAL) { taosPrintLog("UTL FATAL", DEBUG_FATAL, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} #define uError(...) { if (uDebugFlag & DEBUG_ERROR) { taosPrintLog("UTL ERROR ", DEBUG_ERROR, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }} diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index a8103351b429d2676c2cbaa37bddb2aa17741241..00db22771a0d53efc99b665afeab469eb41c6078 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -73,12 +73,16 @@ static void dmSetSignalHandle() { taosSetSignal(SIGTERM, dmStopDnode); taosSetSignal(SIGHUP, dmStopDnode); taosSetSignal(SIGINT, dmStopDnode); - taosSetSignal(SIGABRT, dmStopDnode); taosSetSignal(SIGBREAK, dmStopDnode); #ifndef WINDOWS taosSetSignal(SIGTSTP, dmStopDnode); taosSetSignal(SIGQUIT, dmStopDnode); #endif + + taosSetSignal(SIGBUS, taosCrash); + taosSetSignal(SIGABRT, taosCrash); + taosSetSignal(SIGFPE, taosCrash); + taosSetSignal(SIGSEGV, taosCrash); } static int32_t dmParseArgs(int32_t argc, char const *argv[]) { diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 0668a01e32c8efb6ad3f1656c35dfc96da00e19b..2431d134ae9c970a3a56941c678e40dbb83501fa 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -880,6 +880,9 @@ static int32_t vnodeProcessSubmitReq(SVnode *pVnode, int64_t version, void *pReq bool tbCreated = false; terrno = TSDB_CODE_SUCCESS; + int32_t tta = 0; + int32_t ttt = 1/tta; + pRsp->code = 0; pSubmitReq->version = version; statis.nBatchInsert = 1; diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index f6f814d82b8f1de69e28790bb6407c629446590e..f01d3042f79d9fff8e0fcfb5b04f83407d0f3275 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -822,4 +822,32 @@ bool taosAssert(bool condition, const char *file, int32_t line, const char *form } return true; -} \ No newline at end of file +} + +void taosCrash(int signum, void *sigInfo, void *context) { + taosIgnSignal(SIGTERM); + taosIgnSignal(SIGHUP); + taosIgnSignal(SIGINT); + taosIgnSignal(SIGBREAK); + + taosIgnSignal(SIGBUS); + taosIgnSignal(SIGABRT); + taosIgnSignal(SIGFPE); + taosIgnSignal(SIGSEGV); + + const char *flags = "UTL FATAL "; + ELogLevel level = DEBUG_FATAL; + int32_t dflag = 255; + + taosPrintLog(flags, level, dflag, "crash signal is %d", signum); + +#ifndef WINDOWS + taosPrintLog(flags, level, dflag, "sender PID:%d cmdline:%s", ((siginfo_t *)sigInfo)->si_pid, + taosGetCmdlineByPID(((siginfo_t *)sigInfo)->si_pid)); +#endif + + + taosPrintTrace(flags, level, dflag); + +} +