kriti-sc opened a new pull request, #56443: URL: https://github.com/apache/airflow/pull/56443
Return `410 - GONE` instead of `404 - NOT_FOUND` when the running task instance heartbeats after task is cleared. When a running task is cleared, the previous task instance is moved from the Task Instance table to the Task Instance History table. As a result, if the task instance hearbeats, the api server returns a 404. A more appropriate error is 410. closes: [#53140](https://github.com/apache/airflow/issues/53140) #### Airflow task logs: <img width="1160" height="438" alt="image" src="https://github.com/user-attachments/assets/3c0ca02a-704d-4e01-a6eb-79cd58281471" /> #### Scheduler and API server logs: ``` api-server | [2025-10-06T21:28:42.135650Z] {task_instances.py:608} ERROR - Task Instance not found in Task Instance table, might have moved to the Task Instance History table ti_id=0199bb6c-f0be-7686-a26e-30f70d893ae1 api-server | INFO: 127.0.0.1:53520 - "PUT /execution/task-instances/0199bb6c-f0be-7686-a26e-30f70d893ae1/heartbeat HTTP/1.1" 410 Gone scheduler | [2025-10-06T21:28:42.137967Z] {supervisor.py:1103} ERROR - Server indicated the task shouldn't be running anymore detail={'detail': {'reason': 'not_found', 'message': 'Task Instance not found, might have moved to the Task Instance History table'}} status_code=410 ti_id=UUID('0199bb6c-f0be-7686-a26e-30f70d893ae1') scheduler | [2025-10-06T21:28:42.144732Z] {supervisor.py:713} INFO - Process exited pid=96561 exit_code=0 signal_sent=SIGTERM scheduler | [2025-10-06T21:28:42.144989Z] {supervisor.py:1899} INFO - Task finished exit_code=0 duration=15.431881000055 final_state=SERVER_TERMINATED ``` <!-- Please keep an empty line above the dashes. --> --- **^ Add meaningful description above** Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). -- 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]
