Skip to content

Conversation

@adilkhash
Copy link
Contributor


Airflow doesn't close log file descriptor properly hence leading to too many open files error from the operating system.

closes: #51624

@kaxil kaxil added this to the Airflow 3.0.3 milestone Jun 11, 2025
@adilkhash
Copy link
Contributor Author

adilkhash commented Jun 11, 2025

@kaxil hi, do I need to write tests here? (looks like as a non-trivial case)

@kaxil
Copy link
Member

kaxil commented Jun 11, 2025

Yeah but Mypy is failing though:


task-sdk/src/airflow/sdk/execution_time/supervisor.py:1580: error: Incompatible
types in assignment (expression has type "TextIOWrapper", variable has type
"Optional[BufferedWriter]")  [assignment]
                log_file_descriptor = log_file.open("a", buffering=1)
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
task-sdk/src/airflow/sdk/execution_time/supervisor.py:1581: error: Argument 1
to "WriteLogger" has incompatible type "Optional[BufferedWriter]"; expected
"Optional[TextIO]"  [arg-type]
    ...ing_logger: WrappedLogger = structlog.WriteLogger(log_file_descriptor)
                                                         ^~~~~~~~~~~~~~~~~~~
Found 2 errors in 1 file (checked 110 source files)

Error 1 returned

@kaxil kaxil added the affected_version:3.0 Issues Reported for 3.0 label Jun 11, 2025
Co-authored-by: Ash Berlin-Taylor <ash_github@firemirror.com>
@adilkhash
Copy link
Contributor Author

@ashb @uranusjr thanks for quick review. failing tests were fixed

@ashb ashb merged commit 4a0a89b into apache:main Jun 12, 2025
71 checks passed
@ashb ashb added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Jun 12, 2025
github-actions bot pushed a commit that referenced this pull request Jun 12, 2025
…ction (#51627)

We didn't close log file descriptor properly hence leading to too many open files error from the operating system.
(cherry picked from commit 4a0a89b)

Co-authored-by: Adylzhan Khashtamov <adil.khashtamov@gmail.com>
@github-actions
Copy link

Backport successfully created: v3-0-test

Status Branch Result
v3-0-test PR Link

kaxil pushed a commit that referenced this pull request Jun 12, 2025
…ction (#51627) (#51654)

We didn't close log file descriptor properly hence leading to too many open files error from the operating system.
(cherry picked from commit 4a0a89b)

Co-authored-by: Adylzhan Khashtamov <adil.khashtamov@gmail.com>
choo121600 pushed a commit to choo121600/airflow that referenced this pull request Jun 14, 2025
…e#51627)

We didn't close log file descriptor properly hence leading to too many open files error from the operating system.
@adilkhash adilkhash deleted the adilkhash-patch-1 branch October 7, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affected_version:3.0 Issues Reported for 3.0 backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File descriptor leak: task log files not closed, causing 'Too many open files' in Airflow

4 participants