Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Profiler] Signal-based profiler/Non-Signal-based: prevent deadlock #5808

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ StackSnapshotResultBuffer* LinuxStackFramesCollector::CollectStackSampleImplemen
// Otherwise, the CPU consumption to collect the callstack, will be accounted as "user app CPU time"
auto timerId = pThreadInfo->GetTimerId();

_plibrariesInfo->UpdateCache();

if (selfCollect)
{
// In case we are self-unwinding, we do not want to be interrupted by the signal-based profilers (walltime and cpu)
// This will crashing in libunwind (accessing a memory area which was unmapped)
// This lock is acquired by the signal-based profiler (see StackSamplerLoop->StackSamplerLoopManager)
pThreadInfo->GetStackWalkLock().Acquire();

_plibrariesInfo->UpdateCache();

on_leave
{
pThreadInfo->GetStackWalkLock().Release();
Expand Down Expand Up @@ -143,6 +143,8 @@ StackSnapshotResultBuffer* LinuxStackFramesCollector::CollectStackSampleImplemen
}
};

_plibrariesInfo->UpdateCache();

std::unique_lock<std::mutex> stackWalkInProgressLock(s_stackWalkInProgressMutex);

const auto threadId = static_cast<::pid_t>(pThreadInfo->GetOsThreadId());
Expand Down
Loading