fix that memory_dump swallow all sigsegv

This commit is contained in:
tushicheng 2024-04-11 10:25:28 +00:00 committed by ob-robot
parent acb0d73a97
commit 3c0776dbd6
2 changed files with 18 additions and 0 deletions

View File

@ -460,6 +460,7 @@ int label_stat(AChunk *chunk, ABlock *block, AObject *object,
litem->count_ = 1; litem->count_ = 1;
litem->block_cnt_ = 1; litem->block_cnt_ = 1;
litem->chunk_cnt_ = 1; litem->chunk_cnt_ = 1;
ObSignalHandlerGuard guard(ob_signal_handler);
ret = lmap.set_refactored(key, LabelInfoItem(litem, chunk, block)); ret = lmap.set_refactored(key, LabelInfoItem(litem, chunk, block));
} }
} }
@ -484,6 +485,7 @@ int malloc_sample_stat(uint64_t tenant_id, uint64_t ctx_id,
item->alloc_count_ += 1; item->alloc_count_ += 1;
item->alloc_bytes_ += offset; item->alloc_bytes_ += offset;
} else { } else {
ObSignalHandlerGuard guard(ob_signal_handler);
ret = malloc_sample_map.set_refactored(key, ObMallocSampleValue(1, offset)); ret = malloc_sample_map.set_refactored(key, ObMallocSampleValue(1, offset));
} }
} }

View File

@ -32,6 +32,22 @@ extern const int MP_SIG; // MP means MULTI-PURPOSE
extern const int SIG_STACK_SIZE; extern const int SIG_STACK_SIZE;
extern uint64_t g_rlimit_core; extern uint64_t g_rlimit_core;
struct ObSignalHandlerGuard
{
public:
ObSignalHandlerGuard(signal_handler_t handler)
: last_(get_signal_handler())
{
get_signal_handler() = handler;
}
~ObSignalHandlerGuard()
{
get_signal_handler() = last_;
}
private:
const signal_handler_t last_;
};
class DTraceId class DTraceId
{ {
public: public: