Sensors stuck in queued after being spot interrupted #40516
Labels
area:providers
kind:bug
This is a clearly a bug
provider:cncf-kubernetes
Kubernetes provider related issues
Apache Airflow Provider(s)
cncf-kubernetes
Versions of Apache Airflow Providers
apache-airflow-providers-cncf-kubernetes==8.3.2
apache-airflow-providers-common-io==1.3.2
apache-airflow-providers-http==4.12.0
apache-airflow-providers-postgres==5.11.2
Apache Airflow version
2.9.2
Operating System
Debian GNU/Linux 12 (bookworm)
Deployment
Other Docker-based deployment
Deployment details
We deploy Docker containers based on the official Airflow images (apache/airflow:slim-2.9.2-python3.11) to an AWS EKS kubernetes cluster running Kubernetes 1.29.
What happened
When a sensor is stopped due to a spot interrupt, it can end up stuck in the
queued
state, never getting into the `running state. In the scheduler logs, this information is reported:Restarting the scheduler allows the sensors to recover and get into the
running
state again.What you think should happen instead
Sensors should be able to recover from a spot interrupt without needing to restart the scheduler.
I have tested multiple versions of the apache-airflow-providers-cncf-kubernetes provider, and this used to work correctly up until version 8.0.1. Starting from version 8.1.0, this has been broken (I've tested this on 8.1.0, 8.2.0, 8.3.1 and 8.3.2). This seems to be a regression.
How to reproduce
I've used the following definition to test this behavior.
This will just start a number of Python sensors which will never succeed and keep running until timeout.
To trigger the behavior, one needs to spot interrupt the node where a sensor is running, but not the one where the scheduler is running. Restarting the scheduler allows the task to recover, so we want to only spot interrupt the task, while the scheduler stays healthy. You can look for a node matching these two constraints using k9s or kubectl, and then use the AWS console to initiate an interruption on the spot request for that node (can be done from the EC2 service).
Anything else
By following the reproduction steps as described, I can trigger this issue every time.
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: