diff --git a/backend/windmill-api-jobs/src/concurrency_groups.rs b/backend/windmill-api-jobs/src/concurrency_groups.rs index ee30bceee5..d4e0d175aa 100644 --- a/backend/windmill-api-jobs/src/concurrency_groups.rs +++ b/backend/windmill-api-jobs/src/concurrency_groups.rs @@ -337,11 +337,12 @@ async fn get_concurrent_intervals( let sql_c = sqlb_c.query()?; let mut tx = user_db.begin(&authed).await?; - let running_jobs: Vec = if lq.success.is_none() && lq.resolved != Some(true) { - sqlx::query_as(&sql_q).fetch_all(&mut *tx).await? - } else { - vec![] - }; + let running_jobs: Vec = + if lq.success.is_none() && lq.resolved != Some(true) && lq.system_error != Some(true) { + sqlx::query_as(&sql_q).fetch_all(&mut *tx).await? + } else { + vec![] + }; let completed_jobs: Vec = if lq.running.is_none() { sqlx::query_as(&sql_c).fetch_all(&mut *tx).await? } else { diff --git a/backend/windmill-api-jobs/src/types.rs b/backend/windmill-api-jobs/src/types.rs index 92926ff0d9..ac2d37ef43 100644 --- a/backend/windmill-api-jobs/src/types.rs +++ b/backend/windmill-api-jobs/src/types.rs @@ -333,7 +333,7 @@ pub struct UnifiedJob { macro_rules! system_error_sql { () => { "COALESCE(v2_job_completed.status = 'failure' AND v2_job_completed.result->'error'->>'name' \ - IN ('InternalErr', 'SqlErr', 'ConnectingToDatabase', 'WorkerLost', 'OutOfMemory'), false)" + IN ('SqlErr', 'ConnectingToDatabase', 'WorkerLost', 'OutOfMemory'), false)" }; } pub const SYSTEM_ERROR_SQL: &str = system_error_sql!(); diff --git a/backend/windmill-api/openapi.yaml b/backend/windmill-api/openapi.yaml index 9d9022e57b..5103580a0b 100644 --- a/backend/windmill-api/openapi.yaml +++ b/backend/windmill-api/openapi.yaml @@ -17586,9 +17586,9 @@ paths: type: boolean - name: system_error description: >- - filter on whether a failed run failed because of the platform (internal or - database error, lost worker, out of memory) rather than its code. true keeps only - those runs, false hides them + filter on whether a failed run failed because of the platform (database error, + lost worker, out of memory) rather than its code. true keeps only those runs, + false hides them in: query schema: type: boolean @@ -17906,9 +17906,9 @@ paths: type: boolean - name: system_error description: >- - filter on whether a failed run failed because of the platform (internal or - database error, lost worker, out of memory) rather than its code. true keeps only - those runs, false hides them + filter on whether a failed run failed because of the platform (database error, + lost worker, out of memory) rather than its code. true keeps only those runs, + false hides them in: query schema: type: boolean @@ -18196,9 +18196,9 @@ paths: type: boolean - name: system_error description: >- - filter on whether a failed run failed because of the platform (internal or - database error, lost worker, out of memory) rather than its code. true keeps only - those runs, false hides them + filter on whether a failed run failed because of the platform (database error, + lost worker, out of memory) rather than its code. true keeps only those runs, + false hides them in: query schema: type: boolean @@ -27117,9 +27117,9 @@ paths: type: boolean - name: system_error description: >- - filter on whether a failed run failed because of the platform (internal or - database error, lost worker, out of memory) rather than its code. true keeps only - those runs, false hides them + filter on whether a failed run failed because of the platform (database error, + lost worker, out of memory) rather than its code. true keeps only those runs, + false hides them in: query schema: type: boolean @@ -32237,8 +32237,8 @@ components: type: boolean description: >- true when this failed run failed because of the platform rather than its code, - derived from its error name: InternalErr, SqlErr, ConnectingToDatabase, - WorkerLost or OutOfMemory + derived from its error name: SqlErr, ConnectingToDatabase, WorkerLost or + OutOfMemory trigger_kind: $ref: "#/components/schemas/JobTriggerKind" worker: diff --git a/backend/windmill-api/src/jobs.rs b/backend/windmill-api/src/jobs.rs index e95cbb4f64..560d536169 100644 --- a/backend/windmill-api/src/jobs.rs +++ b/backend/windmill-api/src/jobs.rs @@ -4678,7 +4678,8 @@ async fn list_filtered_job_uuids( // Same reasoning as the runs-list union gate: "resolved only" is a completed-jobs // concept, so unioning the queue would feed queued jobs into bulk actions taken // under that filter. "hide resolved" must still keep them. - let query = if lq.status.is_some() || lq.resolved == Some(true) { + let query = if lq.status.is_some() || lq.resolved == Some(true) || lq.system_error == Some(true) + { sqlb.subquery()? } else { let sqlb2 = list_queue_jobs_query( diff --git a/backend/windmill-common/src/error.rs b/backend/windmill-common/src/error.rs index 8a7223177a..b8d6ca15ec 100644 --- a/backend/windmill-common/src/error.rs +++ b/backend/windmill-common/src/error.rs @@ -99,12 +99,12 @@ pub enum Error { WorkerLost(String), } -/// The `error.name`s of a job that the platform failed rather than its own code: an internal or -/// database error while handling it, its worker lost mid-run (no ping, worker gone, restarts -/// exhausted), or its process killed for memory. The runs list derives `system_error` from these, -/// in SQL that must list the same names (`windmill-api-jobs`, `system_error_sql!`). +/// The `error.name`s of a job that the platform failed rather than its own code: a database error +/// while handling it, its worker lost mid-run (no ping, worker gone, restarts exhausted), or its +/// process killed for memory. Not `InternalErr`: the worker also raises it for a job's own bad +/// inputs. The runs list derives `system_error` from these, in SQL that must list the same names +/// (`windmill-api-jobs`, `system_error_sql!`). pub const SYSTEM_ERROR_NAMES: &[&str] = &[ - "InternalErr", "SqlErr", "ConnectingToDatabase", "WorkerLost", diff --git a/backend/windmill-worker/src/result_processor.rs b/backend/windmill-worker/src/result_processor.rs index 2f00b80c5f..d2762c83ee 100644 --- a/backend/windmill-worker/src/result_processor.rs +++ b/backend/windmill-worker/src/result_processor.rs @@ -662,9 +662,14 @@ pub async fn process_result( job.flow_step_id.clone(), ) } - Connection::Http(_) => { - to_raw_value(&"See logs for more details".to_string()) - } + // An agent worker cannot read the logs back, but the error keeps its + // name and exit code, which is what classifies an OOM kill. + Connection::Http(_) => extract_error_value( + &program, + "See logs for more details", + i, + job.flow_step_id.clone(), + ), } } } @@ -2206,6 +2211,21 @@ pub fn extract_error_value( }); } +#[cfg(test)] +mod exit_error_tests { + #[test] + fn only_exit_137_is_out_of_memory() { + let name = |code| { + let v: serde_json::Value = + serde_json::from_str(super::extract_error_value("p", "", code, None).get()) + .unwrap(); + v["name"].as_str().unwrap().to_string() + }; + assert_eq!(name(137), "OutOfMemory"); + assert_eq!(name(1), "ExecutionErr"); + } +} + #[cfg(all(test, feature = "enterprise", feature = "private"))] mod git_sync_pr_tests { use super::{git_sync_deploy_pr_head_branch, git_sync_push_result_pushed};