多实例录制CPU profiler过程中,销毁Woker实例,会导致方舟主线程采样崩溃,进程退出。

issues:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8ADBJ1

Signed-off-by: rentangyu <rentangyu@huawei.com>
This commit is contained in:
rentangyu 2023-10-24 10:40:02 +08:00
parent 5eb60f158a
commit 7e6d93ce5c
3 changed files with 11 additions and 2 deletions

View File

@ -563,4 +563,9 @@ bool CpuProfiler::GetBuildNapiStack()
{
return isBuildNapiStack_.load();
}
bool CpuProfiler::GetOutToFile()
{
return outToFile_;
}
} // namespace panda::ecmascript

View File

@ -93,6 +93,7 @@ public:
void RecordCallNapiInfo(const std::string &methodAddr);
void SetBuildNapiStack(bool flag);
bool GetBuildNapiStack();
bool GetOutToFile();
explicit CpuProfiler(const EcmaVM *vm, const int interval = CPUPROFILER_DEFAULT_INTERVAL);
virtual ~CpuProfiler();

View File

@ -236,8 +236,11 @@ EcmaVM::~EcmaVM()
initialized_ = false;
#if defined(ECMASCRIPT_SUPPORT_CPUPROFILER)
if (thread_->isProfiling_) {
DFXJSNApi::StopCpuProfilerForFile(this);
DFXJSNApi::StopCpuProfilerForInfo(this);
if (profiler_->GetOutToFile()) {
DFXJSNApi::StopCpuProfilerForFile(this);
} else {
DFXJSNApi::StopCpuProfilerForInfo(this);
}
}
#endif
#if defined(ECMASCRIPT_SUPPORT_HEAPPROFILER)