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

   This PR fixes a critical crash in the UI log viewer when a 
[TaskInstance](cci:2://file:///Users/gouravnss/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py:173:0-702:27)
 has an empty 
[hostname](cci:1://file:///Users/gouravnss/airflow/task-sdk/src/airflow/sdk/api/client.py:137:0-139:76)
 field. 
   
   In certain environments (e.g., workers behind corporate proxies), if the 
worker fails to successfully report its hostname via the internal Execution 
API, the 
[hostname](cci:1://file:///Users/gouravnss/airflow/task-sdk/src/airflow/sdk/api/client.py:137:0-139:76)
 defaults to an empty string in the database. When the webserver attempts to 
fetch logs, it currently constructs a malformed URL (`http://:8793/...`), 
causing the 
[requests](cci:1://file:///Users/gouravnss/airflow/task-sdk/src/airflow/sdk/execution_time/supervisor.py:631:4-665:17)
 library to raise an `InvalidURL: No host supplied` exception. This results in 
a completely broken log viewer page for the user.
   
   **Changes:**
   - Modified 
[_get_log_retrieval_url](cci:1://file:///Users/gouravnss/airflow/airflow-core/src/airflow/utils/log/file_task_handler.py:706:4-735:9)
 in 
[file_task_handler.py](cci:7://file:///Users/gouravnss/airflow/airflow-core/src/airflow/utils/log/file_task_handler.py:0:0-0:0)
 to validate that a 
[hostname](cci:1://file:///Users/gouravnss/airflow/task-sdk/src/airflow/sdk/api/client.py:137:0-139:76)
 is present before URL construction.
   - Added a descriptive `ValueError` raise if the hostname is missing, which 
prevents the unhandled malformed-URL crash in the networking layer.
   
   closes: #64263
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (Gemini for pr description)


-- 
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