Repository navigation
Closed
Copy link
Labels
affected_version:3.0Issues Reported for 3.0area:corearea:dynamic-task-mappingAIP-42area:schedulerkind:bugThis is a clearly a bugpriority:criticalShowstopper bug that should be patched immediatelyprovider:cncf-kubernetesKubernetes (k8s) provider related issues
Milestone
Description
Apache Airflow version
main (development)
If "Other Airflow 2 version" selected, which one?
No response
What happened?
Scheduler crashed with below error
scheduler [2025-09-03T09:35:11.810+0000] {taskinstance.py:1692} INFO - Marking task as FAILED. dag_id=datetime_mapped, task_id=expanded_timedelta, run_id=manual__2025-09-03T09:35:09.924713+00:00, map_index=0, logical_date=20250903T093508, start_date=, end_date=20250903T093511
scheduler [2025-09-03T09:35:11.812+0000] {scheduler_job_runner.py:998} ERROR - Exception when executing SchedulerJob._run_scheduler_loop
scheduler Traceback (most recent call last):
scheduler File "/usr/local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 994, in _execute
scheduler self._run_scheduler_loop()
scheduler File "/usr/local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 1297, in _run_scheduler_loop
scheduler num_finished_events += self._process_executor_events(
scheduler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler File "/usr/local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 741, in _process_executor_events
scheduler return SchedulerJobRunner.process_executor_events(
scheduler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler File "/usr/local/lib/python3.12/site-packages/airflow/jobs/scheduler_job_runner.py", line 932, in process_executor_events
scheduler ti.handle_failure(error=msg, session=session)
scheduler File "/usr/local/lib/python3.12/site-packages/airflow/utils/session.py", line 98, in wrapper
scheduler return func(*args, **kwargs)
scheduler ^^^^^^^^^^^^^^^^^^^^^
scheduler File "/usr/local/lib/python3.12/site-packages/airflow/models/taskinstance.py", line 1695, in handle_failure
scheduler and failure_context["email_for_state"](failure_task)
scheduler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler File "<attrs generated getattr airflow.models.mappedoperator.MappedOperator>", line 11, in __getattr__
scheduler return super().__getattribute__(item)
scheduler ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
scheduler AttributeError: 'MappedOperator' object has no attribute 'email_on_failure'
scheduler [2025-09-03T09:35:11.818+0000] {kubernetes_executor.py:617} INFO - Shutting down Kubernetes executor
scheduler [2025-09-03T09:35:12.062+0000] {kubernetes_executor_utils.py:265} INFO - Event: datetime-mapped-static-datetime-sexsqeeu is Running, annotations: <omitted>
scheduler [2025-09-03T09:35:12.082+0000] {kubernetes_executor_utils.py:265} INFO - Event: datetime-mapped-static-timedelta-uqmyfzln is Running, annotations: <omitted>
scheduler [2025-09-03T09:35:24.629+0000] {kubernetes_executor_utils.py:265} INFO - Event: datetime-mapped-get-delays-zyibzufw is Running, annotations: <omitted>
scheduler [2025-09-03T09:35:25.829+0000] {kubernetes_executor_utils.py:252} INFO - Event: datetime-mapped-get-delays-zyibzufw Succeeded, annotations: <omitted>
scheduler [2025-09-03T09:35:26.122+0000] {scheduler_job_runner.py:252} INFO - Exiting gracefully upon receiving signal 15
scheduler [2025-09-03T09:35:35.457+0000] {kubernetes_executor_utils.py:197} INFO - Event: pod datetime-mapped-op-sleep-90-ou6yuu37 adopted, annotations: <omitted>
scheduler [2025-09-03T09:35:35.458+0000] {kubernetes_executor_utils.py:93} ERROR - Unknown error in KubernetesJobWatcher. Failing
scheduler Traceback (most recent call last):
scheduler File "/usr/local/lib/python3.12/site-packages/astronomer/kubernetes/executors/kubernetes_executor_utils.py", line 86, in run
scheduler self.resource_version = self._run(
scheduler ^^^^^^^^^^
scheduler File "/usr/local/lib/python3.12/site-packages/astronomer/kubernetes/executors/kubernetes_executor_utils.py", line 158, in _run
scheduler self.process_status(
scheduler File "/usr/local/lib/python3.12/site-packages/astronomer/kubernetes/executors/kubernetes_executor_utils.py", line 198, in process_status
scheduler self.watcher_queue.put((pod_name, namespace, ADOPTED, annotations, resource_version))
scheduler File "<string>", line 2, in put
scheduler File "/usr/local/lib/python3.12/multiprocessing/managers.py", line 827, in _callmethod
scheduler conn.send((self._id, methodname, args, kwds))
scheduler File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 206, in send
scheduler self._send_bytes(_ForkingPickler.dumps(obj))
scheduler File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 427, in _send_bytes
scheduler self._send(header + buf)
scheduler File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 384, in _send
scheduler n = write(self._handle, buf)
scheduler ^^^^^^^^^^^^^^^^^^^^^^^^
scheduler BrokenPipeError: [Errno 32] Broken pipe
scheduler Process KubernetesJobWatcher-3:
scheduler Traceback (most recent call last):
scheduler File "/usr/local/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
scheduler self.run()
scheduler File "/usr/local/lib/python3.12/site-packages/astronomer/kubernetes/executors/kubernetes_executor_utils.py", line 86, in run
scheduler self.resource_version = self._run(
scheduler ^^^^^^^^^^
scheduler File "/usr/local/lib/python3.12/site-packages/astronomer/kubernetes/executors/kubernetes_executor_utils.py", line 158, in _run
scheduler self.process_status(
scheduler File "/usr/local/lib/python3.12/site-packages/astronomer/kubernetes/executors/kubernetes_executor_utils.py", line 198, in process_status
scheduler self.watcher_queue.put((pod_name, namespace, ADOPTED, annotations, resource_version))
scheduler File "<string>", line 2, in put
scheduler File "/usr/local/lib/python3.12/multiprocessing/managers.py", line 827, in _callmethod
scheduler conn.send((self._id, methodname, args, kwds))
scheduler File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 206, in send
scheduler self._send_bytes(_ForkingPickler.dumps(obj))
scheduler File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 427, in _send_bytes
scheduler self._send(header + buf)
scheduler File "/usr/local/lib/python3.12/multiprocessing/connection.py", line 384, in _send
scheduler n = write(self._handle, buf)
scheduler ^^^^^^^^^^^^^^^^^^^^^^^^
scheduler BrokenPipeError: [Errno 32] Broken pipe
stream closed EOF for optical-convection-8310/optical-convection-8310-scheduler-7b5857c597-5ggmj (scheduler-gc)
stream closed EOF for optical-convection-8310/optical-convection-8310-scheduler-7b5857c597-5ggmj (scheduler)
What you think should happen instead?
No response
How to reproduce
Execute below DAG with kubernetes executor in main
from datetime import datetime, timedelta
from time import sleep
from airflow.sdk import DAG
from airflow.decorators import task
from airflow.models.taskinstance import TaskInstance
from airflow.providers.standard.operators.python import PythonOperator
from airflow.providers.standard.sensors.date_time import DateTimeSensor, DateTimeSensorAsync
from airflow.providers.standard.sensors.time_delta import TimeDeltaSensor, TimeDeltaSensorAsync
delays = [30, 60, 90]
@task
def get_delays():
return delays
@task
def get_wakes(delay, **context):
"Wake {delay} seconds after the task starts"
ti: TaskInstance = context["ti"]
return (ti.start_date + timedelta(seconds=delay)).isoformat()
with DAG(
dag_id="datetime_mapped",
start_date=datetime(1970, 1, 1),
schedule=None,
tags=["taskmap"]
) as dag:
wake_times = get_wakes.expand(delay=get_delays())
DateTimeSensor.partial(task_id="expanded_datetime").expand(target_time=wake_times)
TimeDeltaSensor.partial(task_id="expanded_timedelta").expand(
delta=list(map(lambda x: timedelta(seconds=x), [30, 60, 90]))
)
DateTimeSensorAsync.partial(task_id="expanded_datetime_async").expand(
target_time=wake_times
)
TimeDeltaSensorAsync.partial(task_id="expanded_timedelta_async").expand(
delta=list(map(lambda x: timedelta(seconds=x), [30, 60, 90]))
)
TimeDeltaSensor(task_id="static_timedelta", delta=timedelta(seconds=90))
DateTimeSensor(
task_id="static_datetime",
target_time="{{macros.datetime.now() + macros.timedelta(seconds=90)}}",
)
PythonOperator(task_id="op_sleep_90", python_callable=lambda: sleep(90))
Operating System
Linux
Versions of Apache Airflow Providers
No response
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
affected_version:3.0Issues Reported for 3.0area:corearea:dynamic-task-mappingAIP-42area:schedulerkind:bugThis is a clearly a bugpriority:criticalShowstopper bug that should be patched immediatelyprovider:cncf-kubernetesKubernetes (k8s) provider related issues
Activity
uranusjr commentedon Sep 3, 2025
Hmm, we shouldn’t send emails from the scheduler, only in the worker. At least that’s my understanding. If that’s the case, MappedOperator is fine here, but we need to fix whatever is trying to access this code path (and maybe remove this entirely?)
uranusjr commentedon Sep 3, 2025
There are probably two issues here
vatsrahul1001 commentedon Sep 3, 2025
@uranusjr I see DAG passed, however its making scheduler crash. Also only happening with k8s executor
uranusjr commentedon Sep 3, 2025
That’s also weird—if the dag passes, why does it even want to call
handle_failurewhen there’s… no failure?ephraimbuddy commentedon Sep 3, 2025
This happened because the task failed to start and ti.handle failure was called to at least run a callback. We probably need to rethink it. Been long it was added. Commit: 44f601e
tirkarthi commentedon Sep 3, 2025
I also noticed this issue yesterday.
#55182
uranusjr commentedon Sep 3, 2025
Hmm why does this not show up in the grid though?