Shawnsuun opened a new pull request, #77010:
URL: https://github.com/apache/airflow/pull/77010

   The default `log_filename_template` prefixes IDs with `dag_id=`, `run_id=` 
and `task_id=`. IDs can be up to 250 characters (`ID_LEN`), so a single path 
component can reach 257-258 bytes, over the 255-byte file name limit of most 
filesystems. Opening that log file fails with `OSError: [Errno 36] File name 
too long` (`ENAMETOOLONG`), and:
   
   - the task supervisor aborts in `supervise_task` before the task runs;
   - in the triggerer, `TriggerLoggingFactory` raises while processing trigger 
log messages;
   - the log reader reports the log as missing on the worker without saying why.
   
   This change:
   
   - **Supervisor**: on `ENAMETOOLONG` from `_configure_logging`, logs a 
warning and runs the task with console logging instead of a local log file.
   - **Triggerer**: `TriggerLoggingFactory` falls back to a console logger on 
`ENAMETOOLONG` and caches it; `upload_to_remote()`/`close()` stay no-ops.
   - **`FileTaskHandler._read`**: if a rendered log path component is longer 
than 255 bytes, skips the local/served-log reads and adds a source message 
explaining why, suggesting shorter IDs, a shorter `[logging] 
log_filename_template`, or remote logging. Remote and executor logs are still 
read.
   
   Other `OSError`s still propagate, and the filename template contract does 
not change.
   
   Tests cover the 255/256-byte boundary in the supervisor, the triggerer 
fallback, and the reader for an over-long ASCII component and a multibyte 
component that is short in characters but over 255 bytes.
   
   Performance: the only happy-path additions are the `try`/`except` wrappers 
around the supervisor and triggerer log-file opens (no measurable cost: 62.2 ns 
vs 61.9 ns for a wrapped vs unwrapped call, medians of 5 runs) and the 
path-component check in `FileTaskHandler._read` (about 1.5 µs per log read; 
control `os.path.join` 308 ns).
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: GitHub Copilot CLI (Claude Opus 5.5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to