Known issues

Managed Airflow (Gen 3) | Managed Airflow (Gen 2) | Managed Airflow (Legacy Gen 1)

This page lists known Managed Airflow issues. For information about issue fixes, see Release notes.

First DAG run for an uploaded DAG file has several failed tasks

When you upload a DAG file, sometimes the first few tasks from the first DAG run for it fail with the Unable to read remote log... error. This problem happens because the DAG file is synchronized between your environment's bucket, Airflow workers, and Airflow schedulers of your environment. If the scheduler gets the DAG file and schedules it to be executed by a worker, and if the worker does not have the DAG file yet, then the task execution fails.

To mitigate this issue, environments with Airflow 2 are configured to perform two retries for a failed task by default. If a task fails, it is retried twice with 5 minute intervals.

Managed Airflow shouldn't be impacted by Apache Log4j 2 Vulnerability (CVE-2021-44228)

In response to Apache Log4j 2 Vulnerability (CVE-2021-44228), Managed Airflow has conducted a detailed investigation and we believe that Managed Airflow is not vulnerable to this exploit.

Airflow UI might sometimes not re-load a plugin once it is changed

If a plugin consists of many files that import other modules, then the Airflow UI might not be able to recognize the fact that a plugin should be re-loaded. In such a case, restart the Airflow web server of your environment.

Error 504 when accessing the Airflow UI

You can get the 504 Gateway Timeout error when accessing the Airflow UI. This error can have several causes:

  • Transient communication issue. In this case, attempt to access the Airflow UI later. You can also restart the Airflow web server.

  • (Managed Airflow (Gen 3) only) Connectivity issue. If Airflow UI is permanently unavailable, and timeout or 504 errors are generated, make sure that your environment can access *.composer.googleusercontent.com.

  • (Managed Airflow (Gen 2) only) Connectivity issue. If Airflow UI is permanently unavailable, and timeout or 504 errors are generated, make sure that your environment can access *.composer.cloud.google.com. If you use Private Google Access and send traffic over private.googleapis.com Virtual IPs, or VPC Service Controls and send traffic over restricted.googleapis.com Virtual IPs, make sure that your Cloud DNS is configured also for *.composer.cloud.google.com domain names.

  • Unresponsive Airflow web server. If the error 504 persists, but you can still access the Airflow UI at certain times, then the Airflow web server might be unresponsive because it's overwhelmed. Attempt to increase the scale and performance parameters of the web server.

Error 502 when accessing Airflow UI

The error 502 Internal server exception indicates that Airflow UI cannot serve incoming requests. This error can have several causes:

  • Transient communication issue. Try to access Airflow UI later.

  • Failure to start the web server. In order to start, the web server requires configuration files to be synchronized first. Check web server logs for log entries that look similar to: GCS sync exited with 1: gcloud storage cp gs://<bucket-name>/airflow.cfg /home/airflow/gcs/airflow.cfg.tmp or GCS sync exited with 1: gcloud storage cp gs://<bucket-name>/env_var.json.cfg /home/airflow/gcs/env_var.json.tmp. If you see these errors, check if files mentioned in error messages are still present in the environment's bucket.

    In case of their accidental removal (for example, because a retention policy was configured), you can restore them:

    1. Set a new environment variable in your environment. You can use use any variable name and value.

    2. Override an Airflow configuration option. You can use a non-existent Airflow configuration option.

Error 500 when accessing the Airflow UI after overriding [webserver]analytics_tool

In environments with Airflow 2, if you override the [webserver]analytics_tool Airflow configuration option to route anonymous Airflow UI usage data to an analytics service (such as Google Analytics, Segment, MetaRouter, or Matomo), accessing the Airflow UI after the environment update succeeds might return a (500) Internal Server Error response, with one of the following errors in the Airflow web server logs:

airflow.exceptions.AirflowConfigException: section/key [webserver/analytics_id] not found in config
airflow.exceptions.AirflowConfigException: section/key [webserver/analytics_url] not found in config

When [webserver]analytics_tool is set in Airflow 2, the Airflow web server requires companion analytics options in the [webserver] section to also be defined when rendering the Airflow UI.

In Airflow 3, [webserver]analytics_tool, [webserver]analytics_id, and [webserver]analytics_url configuration options are removed.

Solutions:

  • Remove the override for the [webserver]analytics_tool Airflow configuration option, or
  • Specify all required Airflow configuration options together:
    • [webserver]analytics_tool
    • [webserver]analytics_id
    • [webserver]analytics_url (required in Airflow 2.9 and later, even if your analytics tool doesn't use a custom URL)

Hovering over task instance in Tree view throws uncaught TypeError

In Airflow 2, the Tree view in the Airflow UI might sometimes not work properly when a non-default timezone is used. As a workaround for this issue, configure the timezone explicitly in the Airflow UI.

Empty folders in Scheduler and Workers

Managed Airflow does not actively remove empty folders from Airflow workers and schedulers. Such entities might be created as a result of the environment bucket synchronization process when these folders existed in the bucket and were eventually removed.

Recommendation: Adjust your DAGs so they are prepared to skip such empty folders.

Such entities are eventually removed from local storages of Airflow schedulers and workers when these components are restarted (for example, as a result of scaling down or maintenance operations in your environment's cluster).

Support for Kerberos

Managed Airflow does not support Airflow Kerberos configuration.

Support for compute classes in Managed Airflow (Gen 2) and Managed Airflow (Gen 3)

Managed Airflow (Gen 3) and Managed Airflow (Gen 2) support only general-purpose compute class. It means that running Pods that request other compute classes (such as Balanced or Scale-Out) is not possible.

The general-purpose class allows for running Pods requesting up to 110 GB of memory and up to 30 CPU (as described in Compute Class Max Requests.

If you want to use ARM-based architecture or require more CPU and Memory, then you must use a different compute class, which is not supported within Managed Airflow (Gen 3) and Managed Airflow (Gen 2) clusters.

Recommendation: Use GKEStartPodOperator to run Kubernetes Pods on a different cluster that supports the selected compute class. If you run custom Pods requiring a different compute class, then they also must run on a non-Managed Airflow cluster.

It's not possible to reduce Cloud SQL storage

Managed Airflow uses Cloud SQL to run Airflow database. Over time, disk storage for the Cloud SQL instance might grow because the disk is scaled up to fit the data stored by Cloud SQL operations when Airflow database grows.

It's not possible to scale down the Cloud SQL disk size.

As a workaround, if you want to use the smallest Cloud SQL disk size, you can re-create Managed Airflow environments with snapshots.

Database Disk usage metric doesn't reduce after removing records from Cloud SQL

Relational databases, such as Postgres or MySQL, don't physically remove rows when they're deleted or updated. Instead, it marks them as "dead tuples" to maintain data consistency and avoid blocking concurrent transactions.

Both MySQL and Postgres implement mechanisms of reclaiming space after deleted records.

While it's possible to force the database to reclaim unused disk space, this is a resource hungry operation which additionally locks the database making Managed Airflow unavailable. Therefore it's recommended to rely on the building mechanisms for reclaiming the unused space.

Access blocked: Authorization Error

If this issue affects a user, the Access blocked: Authorization Error dialog contains the Error 400: admin_policy_enforced message.

If the API Controls > Unconfigured third-party apps > Don't allow users to access any third-party apps option is enabled in Google Workspace and the Apache Airflow in Managed Airflow app is not explicitly allowed, users are not able to access the Airflow UI unless they explicitly allow the application.

To allow access, perform steps provided in Allow access to Airflow UI in Google Workspace.

Login loop when accessing the Airflow UI

This issue might have the following causes:

The /data folder is not available in Airflow web server

In Managed Airflow (Gen 2) and Managed Airflow (Gen 3), the Airflow web server is meant to be mostly read-only component and Managed Airflow does not synchronize the data/ folder to this component.

Sometimes, you might want to share common files between all Airflow components, including the Airflow web server.

Solution:

  • Wrap the files to be shared with the web server into a PYPI module and install it as a regular PYPI package. After the PYPI module is installed in the environment, the files are added to the images of Airflow components and are available to them.

  • Add files to the plugins/ folder. This folder is synchronized to the Airflow web server.

Non-continuous DAG parse times and DAG bag size diagrams in monitoring

Non-continuous DAG parse times and DAG bag size diagrams on the monitoring dashboard indicate problems with long DAG parse times (more than 5 minutes).

Airflow DAG parse times and DAG bag size graphs showing a series of non-continuous intervals
Figure 1. Non-continuous DAG parse times and DAG bag size graphs (click to enlarge)

Solution: We recommend keeping total DAG parse time under 5 minutes. To reduce DAG parsing time, follow DAG writing guidelines.

Task logs appear with delays

Symptom:

  • In Managed Airflow (Gen 3), Airflow task logs do not appear immediately and are delayed for a few minutes.
  • You might find Logs not found for Cloud Logging filter messages in the Airflow logs

Cause:

If your environment runs a large number of tasks at the same time, task logs can be delayed because the environment's infrastructure size is not enough to process all logs fast enough.

Solutions:

  • Consider increasing the environment's infrastructure size to increase performance.
  • Distribute DAG runs over time, so that tasks are not executed at the same time.

Increased startup times for KubernetesPodOperator and KubernetesExecutor

Pods created with KubernetesPodOperator and tasks executed with KubernetesExecutor experience increased startup times. Managed Airflow team is working on a solution and will announce when the issue is resolved.

Workarounds:

  • Launch Pods with more CPU.
  • If possible, optimize images (less layers, smaller size).

Environment is in the ERROR state after the project's billing account was deleted or deactivated, or the Cloud Composer API was disabled

Managed Airflow environments affected by these problems are non-recoverable:

  • After the project's billing account was deleted or deactivated, even if another account was linked later.
  • After the Cloud Composer API was disabled in the project, even if it was enabled later.

You can do the following to address the problem:

  • You still can access data stored in your environment's buckets, but the environments themselves are no longer usable. You can create a new Managed Airflow environment and then transfer your DAGs and data.

  • If you want to perform any of the operations that make your environments non-recoverable, make sure to back up your data, for example, by creating an environment's snapshot. In this way, you can create another environment and transfer its data by loading this snapshot.

Logs for Airflow tasks aren't collected if [core]execute_tasks_new_python_interpreter is set to True

Managed Airflow doesn't collect logs for Airflow tasks if the [core]execute_tasks_new_python_interpreter Airflow configuration option is set to True.

Possible solution:

  • Remove the override for this configuration option, or set its value to False.

Error while removing Network Attachment when an environment is deleted

If several environments that share the same network attachment are deleted at the same time, some deletion operations fail with an error.

Symptoms:

The following error is generated:

Got error while removing Network Attachment: <error code>

The reported error code can be Bad request: <resource> is not ready, or Precondition failed: Invalid fingerprint.

Possible workarounds:

  • Delete environments that use the same network attachment one by one.

  • Disable connection to a VPC network for your environments before deleting them. We recommend this workaround for automated environment deletion.

Degraded environment performance in several google-api-core package versions

Versions from 2.28.0 to 2.30.2

The google-api-core preinstalled package versions from 2.28.0 to 2.30.2 might cause degraded environment performance, which can result in longer times to execute a task and longer times to move a task from the queued to the executing state.

Base container images for the affected builds are now patched, so newly created environments aren't affected. Only existing environments that haven't refreshed their container images since November 4, 2026 remain affected.

Affected Managed Airflow (Gen 3) builds:

  • composer-3-airflow-3.1.7-build.0 to composer-3-airflow-3.1.7-build.5
  • composer-3-airflow-3.1.0-build.5 to composer-3-airflow-3.1.0-build.10
  • composer-3-airflow-2.11.1-build.0
  • composer-3-airflow-2.10.5-build.22 to composer-3-airflow-2.10.5-build.33
  • composer-3-airflow-2.9.3-build.42 to composer-3-airflow-2.9.3-build.53

Affected Managed Airflow (Gen 2) builds:

  • composer-2.16.10-airflow-2.11.1
  • composer-2.16.0-airflow-2.10.5 to composer-2.16.10-airflow-2.10.5
  • composer-2.16.0-airflow-2.9.3 to composer-2.16.10-airflow-2.9.3

Solutions:

To mitigate this issue in an existing environment, upgrade to an image released on or after November 6, 2026 (which includes google-api-core 2.43.1), upgrade to one of the following builds (which include google-api-core 2.27.0), or follow the self-service mitigation steps in Versions from 2.30.3 to 2.43.0 on Python 3.11:

  • composer-3-airflow-2.11.1-build.1
  • composer-3-airflow-2.10.5-build.34
  • composer-3-airflow-2.9.3-build.54
  • composer-2.16.11-airflow-2.11.1
  • composer-2.16.11-airflow-2.10.5
  • composer-2.16.11-airflow-2.9.3

Versions from 2.30.3 to 2.43.0 on Python 3.11

Starting October 24, 2026, google-api-core package versions 2.30.3 to 2.43.0 (as well as 2.28.0 to 2.30.2) run a Python 3.11 deprecation check that scans installed package metadata whenever a Google Cloud client library is imported in a new Python subprocess.

In Managed Airflow environments that run Python 3.11, this behavior can degrade performance, especially in environments that have many DAGs, frequent short-running tasks, or data lineage integration enabled.

Status:

  • Fixed in November 6, 2026 and later releases: composer-3-airflow-3.3.1-build.6, composer-3-airflow-3.2.2-build.10, composer-3-airflow-2.11.1-build.23, composer-2.17.17-airflow-2.11.1, and later images preinstall google-api-core 2.43.1, which fixes this issue.
  • Patched base images for earlier builds: Base container images for all affected builds listed in this section have been patched across all regions. Newly created environments aren't affected, even if you create them with an earlier build.
  • Existing environments: Environments created before November 5, 2026 keep using previously cached container images until refreshed through scheduled maintenance or one of the mitigation steps in this section.

Symptoms include the following:

  • Increased DAG parsing times and higher CPU usage on Airflow DAG processors.
  • Longer task execution times and higher CPU usage on Airflow workers.
  • Frequent FutureWarning log entries from google/api_core/_python_version_support.py stating that Python 3.11 support ends on 2027-10-24.

Prior to the image refresh, this issue affected Python 3.11 environments where google-api-core version 2.30.3 to 2.43.0 was preinstalled or installed manually, including the following builds.

Affected Managed Airflow (Gen 3) builds:

  • composer-3-airflow-3.3.1-build.0 to composer-3-airflow-3.3.1-build.5
  • composer-3-airflow-3.2.2-build.0 to composer-3-airflow-3.2.2-build.9
  • composer-3-airflow-3.1.8-build.0 to composer-3-airflow-3.1.8-build.4
  • composer-3-airflow-3.1.7-build.7 to composer-3-airflow-3.1.7-build.13
  • composer-3-airflow-2.11.1-build.3 to composer-3-airflow-2.11.1-build.22
  • composer-3-airflow-2.10.5-build.36 to composer-3-airflow-2.10.5-build.52

Affected Managed Airflow (Gen 2) builds:

  • composer-2.17.0-airflow-2.11.1 to composer-2.17.16-airflow-2.11.1
  • composer-2.17.0-airflow-2.10.5 to composer-2.17.13-airflow-2.10.5

Mitigation for existing environments:

  • Fast path in asia-east1, asia-northeast2, europe-central2, me-central1, northamerica-northeast1, and us-south1: If your environment has already completed a scheduled maintenance window, set or update a placeholder environment variable to restart Airflow workloads on patched compute infrastructure:

    gcloud composer environments update ENVIRONMENT_NAME \
      --location LOCATION \
      --update-env-variables=COMPOSER_RELOAD=1
    

    After the operation finishes, check your environment logs. If FutureWarning entries from google/api_core/_python_version_support.py continue to appear in newly started workloads (for example, if scheduled maintenance hasn't run yet or your project uses VPC Service Controls), apply one of the options for all regions.

  • All regions: Choose one of the following options:

    • Option 1: Upgrade your environment. Upgrade to an unaffected build such as composer-3-airflow-3.3.1-build.6, composer-3-airflow-3.2.2-build.10, composer-3-airflow-2.11.1-build.23, or any newer patched build.

    • Option 2: Trigger a PyPI package update (requires PyPI repository access). Update an existing custom PyPI package or install an additional package to rebuild your environment image from the patched base image and restart all Airflow workloads.

      On composer-3-airflow-3.3.1-build.0 through build.5, composer-3-airflow-3.2.2-build.1 through build.9, and composer-3-airflow-3.1.8-build.3 through build.4, you can install google-api-core>=2.43.1. Don't install google-api-core>=2.43.1 on earlier Airflow 3 builds (3.2.2-build.0, 3.1.8-build.0 through build.2, 3.1.7, 3.1.0) or earlier Airflow 2 builds because it requires opentelemetry-api>=1.44.0 and causes dependency conflicts; trigger another PyPI package update instead.

  • Option 3 (alternative workaround without upgrading or changing PyPI packages): Apply a sitecustomize.py runtime patch. Use this option if, for example, your environment uses VPC Service Controls without PyPI repository access and you can't upgrade immediately:

    1. Download sitecustomize.py from GitHub.

    2. Upload sitecustomize.py to the dags/patches folder in your environment's bucket.

    3. Set the PYTHONPATH environment variable to /home/airflow/gcs/dags/patches.

      If PYTHONPATH is already set, then prepend /home/airflow/gcs/dags/patches: to the existing value. Example: /home/airflow/gcs/dags/patches:PREVIOUS_PYTHONPATH_VALUE

    Cleanup: After you upgrade your environment or rebuild its image using the preceding steps, you can remove the PYTHONPATH override and delete dags/patches/sitecustomize.py.

TI is no longer in the running state and task should terminate and Task Not Found errors in Airflow 3

Airflow 3 has two issues issues related to the scheduler losing task state during scheduler restarts:

  • 409 Conflict status: A race condition in schedulers causes duplicate task instance scheduling ( #59378, resolved in #60330).

    This issue is fixed in Airflow 3.2.2.

  • 404 Not Found error: Airflow workers lose track of task instances during a regular scheduler loop restart, which happens after the scheduler reaches [scheduler]num_runs. This changes the existing task instance IDs and generates subsequent 404 errors from a worker that isn't aware of the change ( #53140, #60330, resolved in #61631).

    This issue is fixed in Airflow 3.3.1.

Symptoms

  • 409 Conflict: A restarted scheduler's orphan cleanup state marks active tasks as FAILED, causing the workers to abnormally terminate:

    Server indicated the task shouldn't be running anymore [supervisor]
    detail={'detail': {'reason': 'not_running', 'message': 'TI is no longer in
    the running state and task should terminate', 'current_state': 'scheduled'}} status_code=409 ti_id=UUID('...')
    
  • 404 Not Found: A restarted scheduler loses task states and fails active worker pulse checks:

    Server indicated the task shouldn't be running anymore [detail={'detail':
    {'reason': 'not_found', 'message': 'Task Instance not found'}}]
    [status_code=404] [ti_id=...]
    

Solution:

  • Both issues are fixed in Airflow version 3.3.1 and later. Upgrade your environment to a version that uses Airflow 3.3.1.

Possible workarounds:

  • It isn't possible to completely mitigate the problem in versions of Airflow earlier than 3.3.1. Any external event that causes a single scheduler to unexpectedly restart will trigger 404 and 409 (in Airflow versions earlier than 3.2.2). Examples of such events are auto-upgrades of nodes in your environment's cluster, OOM conditions in Pods, or high memory and CPU consumption by schedulers.

  • Scaling your environment down to one scheduler and setting the [scheduler]num_runs configuration option to -1 mitigates the cause of race conditions in schedulers.

    For a highly resilient (Highly Available) environment, it isn't possible to reduce the number of schedulers to one. You can still set the [scheduler]num_runs to -1.

  • Make sure that memory and CPU consumption by the scheduler are well within the available resource limits.

Apache Beam Java operators stop responding when JAVA_TOOL_OPTIONS is set

Airflow tasks that use Apache Beam Java operators (BeamRunJavaPipelineOperator and DataflowCreateJavaJobOperator) can stop responding or deadlock when the JAVA_TOOL_OPTIONS environment variable is set in the environment.

Cause:

To help mitigate CVE-2026-114938, Managed Airflow automatically sets JAVA_TOOL_OPTIONS="-XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=2" in the environment in affected earlier versions, or you might have configured this environment variable manually.

When JAVA_TOOL_OPTIONS is present in the environment, OpenJDK prints a startup message (Picked up JAVA_TOOL_OPTIONS: ...) to stderr. Because of an issue in the apache-airflow-providers-apache-beam package, the Beam hook reads stderr to EOF before draining stdout. If the Java process writes more than 64 KB to stdout, the task deadlocks. With smaller output, task log streaming and job ID detection stall until the subprocess exits.

Affected versions:

This issue affects environments in the following situations:

  • You set JAVA_TOOL_OPTIONS manually as an environment variable.
  • Managed Airflow sets JAVA_TOOL_OPTIONS automatically on Airflow workers when you create or update an environment in the following versions:
    • Managed Airflow (Gen 3) builds released before November 20, 2026.
    • Environments running composer-3-airflow-3.3.1-build.10, composer-3-airflow-3.2.2-build.14, or composer-3-airflow-2.11.1-build.27 that were created or updated before November 26, 2026.

Symptoms:

  • Tasks running BeamRunJavaPipelineOperator or DataflowCreateJavaJobOperator remain in the running state indefinitely or fail to stream logs until the subprocess finishes.
  • Worker task logs contain the following line from process_fd:

    Picked up JAVA_TOOL_OPTIONS: -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=2
    

Solutions:

Choose one of the following options:

  • Option 1 (recommended): Upgrade to a patched version without JAVA_TOOL_OPTIONS. Upgrade your environment to composer-3-airflow-3.3.1-build.10, composer-3-airflow-3.2.2-build.14, composer-3-airflow-2.11.1-build.27, or a later build. These builds include a patched OpenJDK 21 version and, starting November 25, 2026, don't automatically set JAVA_TOOL_OPTIONS.

    • If you already run one of these November 20, 2026 builds and created or updated your environment before November 26, 2026 (or if your worker task logs still show Picked up JAVA_TOOL_OPTIONS), run an environment update operation (for example, add or update an environment variable) so Airflow workers drop the automatically set JAVA_TOOL_OPTIONS variable.
    • If you manually set JAVA_TOOL_OPTIONS as an environment variable to help mitigate CVE-2026-114938, remove that environment variable after upgrading.

  • Option 2 (workaround without upgrading): Install the workaround Airflow plugin.

    If you can't upgrade immediately, install the beam_pipe_deadlock_fix.py plugin. This plugin replaces run_beam_command to merge stderr into stdout so a single reader drains both streams while keeping the JAVA_TOOL_OPTIONS mitigation for CVE-2026-114938 active. It doesn't require DAG changes or an environment restart.

    1. Download beam_pipe_deadlock_fix.py from GitHub, or copy the code sample following these steps.
    2. Install the plugin by uploading beam_pipe_deadlock_fix.py to the plugins/ folder in your environment's Cloud Storage bucket.

    Cleanup: Delete plugins/beam_pipe_deadlock_fix.py from your environment's bucket after you upgrade to an unaffected Managed Airflow version (with no manual JAVA_TOOL_OPTIONS override) or a version that includes the upstream fix in apache-airflow-providers-apache-beam.

The following code sample shows beam_pipe_deadlock_fix.py from GitHub:

"""Workaround for Apache Beam subprocess pipe deadlock in Cloud Composer.

When the JVM prints a JAVA_TOOL_OPTIONS startup message to stderr and a Beam
command writes more than 64 KB to stdout, the Apache Beam provider can deadlock
while reading the two pipes separately. This plugin replaces run_beam_command
with a version that merges stderr into stdout so one reader drains both streams.

Install:
  Upload this file to the plugins/ folder in your environment's Cloud Storage
  bucket.

Side effect:
  Beam subprocess stderr lines appear in task logs at INFO level instead of
  WARNING.

Cleanup:
  Delete this file after upgrading to a Cloud Composer version that includes
  the upstream fix in apache-airflow-providers-apache-beam.
"""

from __future__ import annotations

import shlex
import subprocess
from typing import Callable

import logging

# Airflow 3.1+ provides AirflowPlugin through the Task SDK; Airflow 2.5 to 3.0
# provides it through airflow.plugins_manager.
try:
    from airflow.sdk.plugins_manager import AirflowPlugin
except ImportError:
    from airflow.plugins_manager import AirflowPlugin


def _patched_run_beam_command(
    cmd: list[str],
    log: logging.Logger,
    process_line_callback: Callable[[str], None] | None = None,
    working_directory: str | None = None,
    is_dataflow_job_id_exist_callback: Callable[[], bool] | None = None,
    check_job_id_by_name_callback: Callable[[], bool] | None = None,
    *,
    check_job_status_callback: Callable[[], bool | None] | None = None,
    **_kwargs: object,
) -> None:
    # Import from the Beam hook module so the raised exception matches the
    # installed provider on both Airflow 2 and Airflow 3.
    from airflow.providers.apache.beam.hooks.beam import AirflowException

    # Support early exit across provider versions: 5.5-6.0 uses
    # check_job_status_callback; 6.0.1+ uses is_dataflow_job_id_exist_callback.
    stop_callback = is_dataflow_job_id_exist_callback or check_job_status_callback

    log.info("Running command: %s", " ".join(shlex.quote(c) for c in cmd))
    # Merge stderr into stdout so a single reader drains all subprocess output.
    proc = subprocess.Popen(
        cmd,
        cwd=working_directory,
        shell=False,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        close_fds=True,
    )
    log.info("Start waiting for Apache Beam process to complete.")

    # Close only the pipe in finally. Streaming and deferrable jobs require an
    # early return once stop_callback succeeds, so proc.wait() runs only after EOF.
    try:
        if proc.stdout is not None:
            for raw_line in iter(proc.stdout.readline, b""):
                line = raw_line.decode("utf-8", errors="replace")
                if process_line_callback:
                    process_line_callback(line)
                log.info("%s", line.rstrip("\r\n"))
                if stop_callback and stop_callback():
                    return
    finally:
        if proc.stdout is not None:
            proc.stdout.close()

    proc.wait()
    log.info("Process exited with return code: %s", proc.returncode)
    if proc.returncode != 0:
        raise AirflowException(
            f"Apache Beam process failed with return code {proc.returncode}"
        )

    # Preserve provider 6.3.2+ fallback for pipelines that disable job ID logs.
    if check_job_id_by_name_callback and not (stop_callback and stop_callback()):
        check_job_id_by_name_callback()


class BeamPipeDeadlockFixPlugin(AirflowPlugin):
    """Registers the patched Beam command runner when Airflow loads plugins."""

    name = "beam_pipe_deadlock_fix"

    @classmethod
    def on_load(cls, *args, **kwargs) -> None:
        # Airflow calls on_load once per process before running tasks.
        try:
            import airflow.providers.apache.beam.hooks.beam as beam_hook_mod
        except ImportError:
            return
        beam_hook_mod.run_beam_command = _patched_run_beam_command

What's next