It seems that Prefect does not automatically delete pods when a crash error occurs. This behavior might be due to the infrastructure's inability to support cancellation or if the infrastructure associated with the run cannot be found or has already been terminated. The worker attempts to cancel the flow run, but if it encounters unexpected errors, the flow run may not be canceled, and the pod remains.
For more details, you can refer to the
Prefect documentation on cancellation which might provide insights into how infrastructure is managed during cancellations.
Additionally, there are no specific GitHub issues directly addressing this exact problem, but the behavior could be related to infrastructure misconfigurations or limitations. If this is a recurring issue, it might be worth raising a new issue on the
Prefect GitHub repository.
If you're using Kubernetes, you might want to manually handle pod deletions or explore configurations that ensure pods are cleaned up after crashes.