From d3a05d495d67e207b75f2cf0a9b4ac168cff5e7a Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 15 Jul 2025 15:36:42 +0000 Subject: [PATCH] prevent forever loops nit --- backend/windmill-queue/src/jobs.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/windmill-queue/src/jobs.rs b/backend/windmill-queue/src/jobs.rs index 68308d3644..2b58d0e522 100644 --- a/backend/windmill-queue/src/jobs.rs +++ b/backend/windmill-queue/src/jobs.rs @@ -2317,6 +2317,9 @@ pub async fn pull( tracing::warn!("Pull job loop count: {}", pull_loop_count); tokio::task::yield_now().await; } + if pull_loop_count > 1000 { + return Ok(PulledJobResult { job: None, suspended: false }); + } if let Some((query_suspended, query_no_suspend)) = query_o { let njob = { let job = if query_suspended.is_empty() { @@ -2523,6 +2526,10 @@ pub async fn pull( tracing::warn!("Window finding job loop count: {}", pull_loop_count); tokio::task::yield_now().await; } + if i > 1000000000 { + tracing::error!("Window finding job loop count exceeded 1000000000, breaking"); + break; + } } tracing::info!("Job '{}' from path '{}' with concurrency key '{}' has reached its concurrency limit of {} jobs run in the last {} seconds. This job will be re-queued for next execution at {} (min_started_at: {min_started_at_or_now}, avg script duration: {:?}, number of time windows full: {})",