Bug 1620549 - Set stack size of profiler sampler thread to N_STACK_BYTES + 20 KiB r=gerald,mstange

N_STACK_BYTES are needed to store backtrace information, so use
that plus some extra as the minimum stack size for the sampler
thread to ensure that it doesn't overflow.

Differential Revision: https://phabricator.services.mozilla.com/D65705

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Forney 2020-03-07 01:16:28 +00:00
Родитель 97c5dd8d40
Коммит 4fa7b340c0
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -406,9 +406,17 @@ SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration,
// Start the sampling thread. It repeatedly sends a SIGPROF signal. Sending
// the signal ourselves instead of relying on itimer provides much better
// accuracy.
if (pthread_create(&mThread, nullptr, ThreadEntry, this) != 0) {
//
// N_STACK_BYTES are needed to store backtrace information, so use that plus
// some extra as the minimum stack size for the sampler thread to ensure that
// it doesn't overflow.
pthread_attr_t attr;
if (pthread_attr_init(&attr) != 0 ||
pthread_attr_setstacksize(&attr, lul::N_STACK_BYTES + 20 * 1024) != 0 ||
pthread_create(&mThread, &attr, ThreadEntry, this) != 0) {
MOZ_CRASH("pthread_create failed");
}
pthread_attr_destroy(&attr);
}
SamplerThread::~SamplerThread() {