diff --git a/Dockerfile b/Dockerfile index 288926cccb1e7..ce7f1d06d4a21 100644 --- a/Dockerfile +++ b/Dockerfile @@ -400,7 +400,7 @@ function install_python() { find /usr/python -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ + -o \( -type f -a \( -name 'libpython*.a' \) \) \ \) -exec rm -rf '{}' + link_python } diff --git a/Dockerfile.ci b/Dockerfile.ci index ec84303493a11..e4bd7c3fc1e7b 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -340,7 +340,7 @@ function install_python() { find /usr/python -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ + -o \( -type f -a \( -name 'libpython*.a' \) \) \ \) -exec rm -rf '{}' + link_python } diff --git a/docker-stack-docs/changelog.rst b/docker-stack-docs/changelog.rst index d1073bf578808..b0d5e192d2ad5 100644 --- a/docker-stack-docs/changelog.rst +++ b/docker-stack-docs/changelog.rst @@ -34,6 +34,18 @@ the Airflow team. any Airflow version from the ``Airflow 2`` line. There is no guarantee that it will work, but if it does, then you can use latest features from that image to build images for previous Airflow versions. +Airflow 3.1.4 +~~~~~~~~~~~~~ + +In Airflow 3.1.4, the images are build without removing of .pyc and .pyo files when Python is built. +This increases the size of the image slightly (<0.5%), but improves performance of Python in the container +because Python does not need to recompile the files on the first run but more importantly, if you use +``exec`` to run Health Checks, removed .pyc files caused a small but ever growing memory leak in the Unix +kernel connected to negative ``dentries`` created when .pyc files were attempted to be compiled and failed. +This over time could lead to out-of-memory issues on the host running the container. + +More information about ``dentries`` can be found in `this article `_. + Airflow 3.1.0 ~~~~~~~~~~~~~ diff --git a/scripts/docker/install_os_dependencies.sh b/scripts/docker/install_os_dependencies.sh index 0488f83ec899f..32929544c3140 100644 --- a/scripts/docker/install_os_dependencies.sh +++ b/scripts/docker/install_os_dependencies.sh @@ -322,7 +322,7 @@ function install_python() { find /usr/python -depth \ \( \ \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ - -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \ + -o \( -type f -a \( -name 'libpython*.a' \) \) \ \) -exec rm -rf '{}' + link_python }