From 27690661363e7b4648f65b243f059c7b5b8647c0 Mon Sep 17 00:00:00 2001 From: Sergei Shulepov Date: Mon, 15 Nov 2021 12:48:00 +0100 Subject: [PATCH] Increase preparation timeout (#4270) * Increase preparation-timeout to 60 seconds * Adapt `pvf_preparation_time` metric to the new value --- polkadot/node/core/pvf/src/metrics.rs | 15 ++++++++++++++- polkadot/node/core/pvf/src/prepare/worker.rs | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/polkadot/node/core/pvf/src/metrics.rs b/polkadot/node/core/pvf/src/metrics.rs index 163330c84c..7d47aea35c 100644 --- a/polkadot/node/core/pvf/src/metrics.rs +++ b/polkadot/node/core/pvf/src/metrics.rs @@ -152,8 +152,21 @@ impl metrics::Metrics for Metrics { prometheus::Histogram::with_opts( prometheus::HistogramOpts::new( "pvf_preparation_time", - "Time spent in preparing PVF artifacts", + "Time spent in preparing PVF artifacts in seconds", ) + .buckets(vec![ + // This is synchronized with COMPILATION_TIMEOUT=60s constant found in + // src/prepare/worker.rs + 0.1, + 0.5, + 1.0, + 10.0, + 20.0, + 30.0, + 40.0, + 50.0, + 60.0, + ]), )?, registry, )?, diff --git a/polkadot/node/core/pvf/src/prepare/worker.rs b/polkadot/node/core/pvf/src/prepare/worker.rs index 8d157bd8f9..768bcd4d09 100644 --- a/polkadot/node/core/pvf/src/prepare/worker.rs +++ b/polkadot/node/core/pvf/src/prepare/worker.rs @@ -35,7 +35,9 @@ use std::{sync::Arc, time::Duration}; const NICENESS_BACKGROUND: i32 = 10; const NICENESS_FOREGROUND: i32 = 0; -const COMPILATION_TIMEOUT: Duration = Duration::from_secs(10); +/// The time period after which the preparation worker is considered unresponsive and will be killed. +// NOTE: If you change this make sure to fix the buckets of `pvf_preparation_time` metric. +const COMPILATION_TIMEOUT: Duration = Duration::from_secs(60); /// Spawns a new worker with the given program path that acts as the worker and the spawn timeout. ///