Skip to content

Visualizing a mapped task from the grid view causes a UI crash #44685

Description

@brouberol

Apache Airflow version

2.10.3

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When I'm inspecting a DAG grid, by going to /dag/<dag_id>/grid, and I click on a grid square representing a DAG mapped task, then an XHR call is performed to /api/v1/dags/<dag_id>/dagRuns/<run_id>/taskInstances/<task_id>, which returns a 404 with the following error:

{
  "detail": "Task instance is mapped, add the map_index value to the URL",
  "status": 404,
  "title": "Task instance not found",
  "type": "https://airflow.apache.org/docs/apache-airflow/2.10.3/stable-rest-api-ref.html#section/Errors/NotFound"
}

When that happens, the page turns white and empty, with a console error linked to Axios crashing to the 404 response.
image

However, when performing the exact same behavior when located on URL /dags/<dag_id>/grid?dag_run_id=<run_id>&task_id=<task_id> (for example by refreshing the page after the crash) then no such XHR call is being sent, and the task panel loads just fine.

Screenshot 2024-12-05 at 10 00 15

What you think should happen instead?

I'm guessing that when located on /dags/<dag_id>/grid with no prior query arg, the UI does not "know" that the task is itself composed of mapped tasks, and thus is calling the wrong API path to inspect it.

How to reproduce

Here's a screen recording of the crash.

Screen.Recording.2024-12-04.at.14.50.05.mov

The webserver logs associated with the crash are

x.x.x.x - - [05/Dec/2024:08:58:05 +0000] "GET /api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export/dependencies HTTP/1.1" 404 323 "https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:05 +0000] "GET /api/v1/dags/refine_to_hive_hourly/tasks/refine_hive_dataset.wait_for_gobblin_export HTTP/1.1" 200 1117 "https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:05 +0000] "GET /api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export HTTP/1.1" 404 249 "https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:06 +0000] "GET /object/grid_data?dag_id=refine_to_hive_hourly&num_runs=25 HTTP/1.1" 200 105027 "https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:06 +0000] "GET /api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export/dependencies HTTP/1.1" 404 323 "https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0"
x.x.x.x - - [05/Dec/2024:08:58:06 +0000] "GET /api/v1/dags/refine_to_hive_hourly/dagRuns/scheduled__2024-12-05T04:00:00+00:00/taskInstances/refine_hive_dataset.wait_for_gobblin_export HTTP/1.1" 404 249 "https://airflow-analytics.wikimedia.org/dags/refine_to_hive_hourly/grid?dag_run_id=scheduled__2024-12-05T04%3A00%3A00%2B00%3A00&task_id=refine_hive_dataset.wait_for_gobblin_export" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:133.0) Gecko/20100101 Firefox/133.0"

Operating System

Debian Bullseye

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==9.0.0
apache-airflow-providers-apache-hdfs==4.6.0
apache-airflow-providers-apache-hive==8.2.0
apache-airflow-providers-apache-spark==4.8.1
apache-airflow-providers-cncf-kubernetes==9.0.1
apache-airflow-providers-common-compat==1.2.1
apache-airflow-providers-common-io==1.4.2
apache-airflow-providers-common-sql==1.19.0
apache-airflow-providers-fab==1.5.0
apache-airflow-providers-ftp==3.11.1
apache-airflow-providers-http==4.13.2
apache-airflow-providers-imap==3.7.0
apache-airflow-providers-postgres==5.13.1
apache-airflow-providers-smtp==1.8.0
apache-airflow-providers-sqlite==3.9.0

Deployment

Other

Deployment details

We're seeing this bug with 2 types of deployments:

  • airflow components running as systemd services on VMs/physical hosts
  • airflow components running as Kubernetes Pods, deployed via a custom chart

Anything else?

This bug is reproducible every time. There does not seem to be a random element to ot.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions