Skip to content

Commit b19b1db

Browse files
authored
chore: Update uvicorn to fix worker timeout issue (#690)
* chore: Update uvicorn to fix worker timeout issue * changelog * bumped resources for overrides test * fix test asserts
1 parent 41ed927 commit b19b1db

File tree

7 files changed

+14
-18
lines changed

7 files changed

+14
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
### Changed
1313

1414
- Use internal secrets for secret- and jwt-keys ([#686]).
15+
- Update uvicorn version and revert to default number of API workers ([#690]).
1516

1617
### Fixed
1718

@@ -31,6 +32,7 @@
3132
[#685]: https://github.com/stackabletech/airflow-operator/pull/685
3233
[#686]: https://github.com/stackabletech/airflow-operator/pull/686
3334
[#687]: https://github.com/stackabletech/airflow-operator/pull/687
35+
[#690]: https://github.com/stackabletech/airflow-operator/pull/690
3436

3537
## [25.7.0] - 2025-07-23
3638

docs/modules/airflow/pages/troubleshooting/index.adoc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,15 @@ See e.g. https://github.com/minio/minio/issues/20845[this MinIO issue] for detai
2929
== Setting API Workers
3030

3131
In Airflow the webserver (called the API Server in Airflow 3.x+) can use multiple workers.
32-
This is determined by the environment variable `+AIRFLOW__API__WORKERS+` and is set by default to `4` in Airflow 2.x and `1` in Airflow 3.x+.
33-
The reason for this difference is that Airflow uses a backend library to manage child processes and in 3.x+ this library can cause child processes to be killed if a hard-coded startup timeout is exceeded.
34-
For most cases with Airflow 3.x+ a default of `1` should be sufficient, but if you run into performance issues and would like to add more workers, you can either modulate multiple worker processes at the level of webserver, keeping the default of a single worker per webserver:
32+
This is determined by the environment variable `+AIRFLOW__API__WORKERS+` and is set by default to `4`.
33+
For most cases the default should work without problem, but if you run into performance issues and would like to add more workers, you can either modulate multiple worker processes at the level of webserver, keeping the default value for each one:
3534

3635
[source,yaml]
3736
----
3837
webservers:
3938
roleGroups:
4039
default:
41-
replicas: 2 # add a replica (with a single worker)
40+
replicas: 2 # add a replica (with the default number of workers)
4241
----
4342

4443
or change the environment variable using `envOverrides`:
@@ -47,7 +46,7 @@ or change the environment variable using `envOverrides`:
4746
----
4847
webservers:
4948
envOverrides:
50-
AIRFLOW__API__WORKERS: 2 # something other than the default of 1
49+
AIRFLOW__API__WORKERS: 6 # something other than the default
5150
----
5251

5352
TIP: Our strong recommendation is to increase the webserver replicas, with each webserver running a single worker, as this removes the risk of running into timeouts or memory issues.

rust/operator-binary/src/env_vars.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -507,17 +507,6 @@ fn add_version_specific_env_vars(
507507
..Default::default()
508508
},
509509
);
510-
// Airflow 3.x uses fast-api as a backend: newer versions of uvicorn can
511-
// cause issues with child processes. See discussion here: <https://github.com/apache/airflow/discussions/50170#discussioncomment-13265000>.
512-
// This will be considered as part of this issue: <https://github.com/stackabletech/airflow-operator/issues/641>.
513-
env.insert(
514-
"AIRFLOW__API__WORKERS".into(),
515-
EnvVar {
516-
name: "AIRFLOW__API__WORKERS".into(),
517-
value: Some("1".into()),
518-
..Default::default()
519-
},
520-
);
521510
}
522511
} else {
523512
env.insert(

tests/templates/kuttl/overrides/10-install-airflow.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ spec:
8686
min: 400m
8787
max: 800m
8888
memory:
89-
limit: 2Gi
89+
limit: 3Gi
9090
podOverrides:
9191
spec:
9292
containers:

tests/templates/kuttl/overrides/11-assert.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ commands:
77
# Test envOverrides
88
#
99
- script: |
10+
set -eu
11+
1012
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "COMMON_VAR" and .value == "group-value")'
1113
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "GROUP_VAR" and .value == "group-value")'
1214
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "ROLE_VAR" and .value == "role-value")'
1315
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "credentialsSecret" and .value == "test-override")'
1416
1517
1618
- script: |
19+
set -eu
20+
1721
kubectl -n $NAMESPACE get sts airflow-celery-worker-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "COMMON_VAR" and .value == "group-value")'
1822
kubectl -n $NAMESPACE get sts airflow-celery-worker-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "GROUP_VAR" and .value == "group-value")'
1923
kubectl -n $NAMESPACE get sts airflow-celery-worker-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "ROLE_VAR" and .value == "role-value")'

tests/templates/kuttl/overrides/20-install-airflow2.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spec:
3232
- name: airflow
3333
resources:
3434
limits:
35-
cpu: 810m
35+
cpu: 2000m
3636
config:
3737
resources:
3838
cpu:

tests/templates/kuttl/overrides/21-assert.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,7 @@ kind: TestAssert
44
timeout: 30
55
commands:
66
- script: |
7+
set -eu
8+
79
kubectl -n $NAMESPACE get cm airflow-kubernetes-executor-pod-template -o json | jq -r '.data."airflow_executor_pod_template.yaml"' | yq -e '.spec.containers.[0].resources.limits | select (.cpu == "750m")'
810
kubectl -n $NAMESPACE get cm airflow-kubernetes-executor-pod-template -o json | jq -r '.data."airflow_executor_pod_template.yaml"' | yq -e '.spec.containers[] | select (.name == "base") | .env[] | select (.name == "AIRFLOW__METRICS__STATSD_ON" and .value == "False")'

0 commit comments

Comments
 (0)