Skip to content

Bug: airflow standalone UI not displaying DAG import errors when SIGSEGV happens #50303

Closed

Description

@tatiana

Apache Airflow version

3.0.0

Python 3.10.16 & 3.12.8

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

No response

What happened?

The Airflow UI (when running airflow standalone) and airflow dags list-import-errors currently do not display the exception when a SIGSEGV happens.

What you think should happen instead?

I believe the Airflow UI (when running airflow standalone) and airflow dags list-import-errors should display the exception when SIGSEGV happens.

How to reproduce

This was initially observed in astronomer/astronomer-cosmos#1754

An agnostic way to reproduce it, though, is:

Create a example_dag.py in the DAGs folder with the following content:

import signal
import os

os.kill(os.getpid(), signal.SIGSEGV)

Run:

airflow dag-processor

Observe there is an error:

dag-processor | [2025-05-07T14:50:52.962+0100] {manager.py:748} INFO -
dag-processor | ================================================================================
dag-processor | DAG File Processing Stats
dag-processor | Bundle       File Path            PID    Current Duration      # DAGs    # Errors  Last Duration    Last Run At
dag-processor | -----------  -------------------  -----  ------------------  --------  ----------  ---------------  -------------------
dag-processor | dags-folder  example_dag.py                                    0           1  0.21s            2025-05-07T13:50:22

Run:

airflow standalone

Open the Airflow UI via web browser:
http://localhost:8080/dags

And don't see any errors:

Image

Running:

airflow dags list-import-errors

Gives:

No data found

Operating System

MacOS 15.4.1

Versions of Apache Airflow Providers

N/A

Deployment

Other

Deployment details

Local standalone

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on May 7, 2025
  2. added
    affected_version:3.0
    and removed
    kind:bug
    on May 7, 2025
  3. added this to the Airflow 3.0.2 milestone on May 7, 2025
  4. added
    area:UI
    kind:bug
    on May 7, 2025
  5. changed the title [-]`airflow standalone` UI not displaying DAG import errors when `SIGSEGV`[/-] [+]Bug: `airflow standalone` UI not displaying DAG import errors when `SIGSEGV` happens[/+] on May 7, 2025
  6. removed
    needs-triage
    on May 26, 2025
  7. ephraimbuddy commented on May 28, 2025

    @ephraimbuddy
    Contributor

    This issue is caused by a segmentation fault disrupting the DAG file loading process. When it occurs, the process exits immediately.

    Since segmentation faults cannot be caught with try...except, one viable solution would be to load DAG file modules in a subprocess. However, I'm thinking this might increase the time it takes to process each file.
    Wdyt, @jedcunningham?

  8. ephraimbuddy commented on May 28, 2025

    @ephraimbuddy
    Contributor

    Reproduction:

    Run airflow dag reserialize --bundle-name dags-folder with the below file in dags folder:

    import signal
    from airflow import DAG
    import os
    from airflow.decorators import task
    
    os.kill(os.getpid(), signal.SIGSEGV)
    
    with DAG('testbug'):
        @task
        def mytask():
            print(1)
        mytask()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

affected_version:3.0area:CLIarea:UIarea:corekind:bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions