From 3fbd8705374acbc95e34238fe71b979de851a47b Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Mon, 2 May 2022 10:05:34 +0200 Subject: Add workaround for unstable gn on macOS in ci In ci 'gn' can crash making it hard to integrate, if there is high load crashes occur more frequently sometimes even blocking integrations for few days. Limit number of worker threads for gn as this improves situation however increases time for generating ninja files from 2s to 7s. Note this will not prevent crashes however significantly reduces the issue (when running in loop from 1 per ~10min to 1 per ~3days) Compilation with address or thread sanitizer does not lead to meaningful traces. Moreover running gn with sanitizer creates deadlocks for unknown reason every few runs. Current assumptions is that macos vms are unstable as crashes also occur for sscache calls (compiler) and python calls. Change-Id: I1c488796eb0547eedd20101606f18ed55718e9c2 Reviewed-by: Alexandru Croitor (cherry picked from commit 2c5b25387c89420cc04decb1298356e452bb5fe5) --- cmake/Functions.cmake | 1 + cmake/Gn.cmake | 4 ++++ coin/module_config.yaml | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/cmake/Functions.cmake b/cmake/Functions.cmake index 7955aab8f..5fd08c8ba 100644 --- a/cmake/Functions.cmake +++ b/cmake/Functions.cmake @@ -1128,6 +1128,7 @@ function(add_gn_command) -DMODULE=${arg_MODULE} -DQT_HOST_GN_PATH=${QT_HOST_GN_PATH} -DPython2_EXECUTABLE=${Python2_EXECUTABLE} + -DGN_THREADS=$ENV{QTWEBENGINE_GN_THREADS} -P ${WEBENGINE_ROOT_SOURCE_DIR}/cmake/Gn.cmake WORKING_DIRECTORY ${WEBENGINE_ROOT_BUILD_DIR} COMMENT "Run gn for target ${arg_CMAKE_TARGET} in ${arg_BUILDDIR}" diff --git a/cmake/Gn.cmake b/cmake/Gn.cmake index 7e40640e6..b00cbaa2f 100644 --- a/cmake/Gn.cmake +++ b/cmake/Gn.cmake @@ -42,6 +42,10 @@ list(APPEND gnArg --script-executable=${Python2_EXECUTABLE} --root=${WEBENGINE_ROOT_SOURCE_DIR}/src/3rdparty/chromium) +if(GN_THREADS) + list(APPEND gnArg --threads=${GN_THREADS}) +endif() + STRING(REGEX REPLACE "\n" ";" printArgArg "${gnArgArg}") LIST(SORT printArgArg) STRING(REGEX REPLACE ";" "\n" printArgArg "${printArgArg}") diff --git a/coin/module_config.yaml b/coin/module_config.yaml index 741558a5a..a40f566c3 100644 --- a/coin/module_config.yaml +++ b/coin/module_config.yaml @@ -12,6 +12,13 @@ instructions: - type: EnvironmentVariable variableName: CMAKE_BUILD_OUTPUT_TIMEOUT variableValue: "3600" + - type: EnvironmentVariable + variableName: QTWEBENGINE_GN_THREADS + variableValue: "1" + enable_if: + condition: property + property: host.os + equals_value: MacOS - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" Test: - type: EnvironmentVariable -- cgit v1.2.3