From 17238b56a1634e4d26ca1ff761ce54a3fcaa32f0 Mon Sep 17 00:00:00 2001 From: Mukilan Thiyagarajan Date: Wed, 24 May 2023 21:35:20 +0530 Subject: [PATCH] Layout-2020: Fix debug mode crash for servo.org servo with layout-2020 segfaults when loading servo.org in debug build, but works fine in release build. It seems like the style pool threads seem to run overrun allocated stack space more quickly than in release mode. Based on https://bugzilla.mozilla.org/show_bug.cgi?id=1376883 it seems the stack size was chosen base on several experiments. It is possible the results of those experiments are no longer valid. This is a temporary workaround to avoid layout 2020 builds from crashing when servo.org is loaded, until we can confirm the theory and implement a more robust solution. Signed-off-by: Mukilan Thiyagarajan --- components/style/parallel.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/style/parallel.rs b/components/style/parallel.rs index 82f003cff71..e578c6bbe51 100644 --- a/components/style/parallel.rs +++ b/components/style/parallel.rs @@ -32,8 +32,14 @@ use rayon; use smallvec::SmallVec; /// The minimum stack size for a thread in the styling pool, in kilobytes. +#[cfg(feature = "gecko")] pub const STYLE_THREAD_STACK_SIZE_KB: usize = 256; +/// The minimum stack size for a thread in the styling pool, in kilobytes. +/// Servo requires a bigger stack in debug builds. +#[cfg(feature = "servo")] +pub const STYLE_THREAD_STACK_SIZE_KB: usize = 512; + /// The stack margin. If we get this deep in the stack, we will skip recursive /// optimizations to ensure that there is sufficient room for non-recursive work. ///