ecodina opened a new issue, #49931:
URL: https://github.com/apache/airflow/issues/49931

   ### Apache Airflow version
   
   3.0.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   I was testing Airflow 3 before upgrading. I've written some test DAGs, but 
the one using TaskFlow (based on the example of the documentation) fails with 
`Connection Refused`:
   
   ```python
   import datetime
   
   from airflow.sdk import dag, task
   
   @dag(
           schedule="@hourly",
           start_date=datetime.datetime(2025, 1, 1),
           dag_id="dag.example4"
   )
   def example():
   
   
       @task()
       def get_data():
           return {"1001": 301.27, "1002": 433.21}
   
       @task()
       def print_data(d):
           print(d["1001"])
   
       data = get_data()
       print_data = print_data(data)
   
   
   example()
   ```
   
   These are the logs of the Scheduler, where I can see the error:
   
   ```bash
   airflow-scheduler-1  | [2025-04-29T07:28:49.897+0000] 
{scheduler_job_runner.py:450} INFO - 1 tasks up for execution:
   airflow-scheduler-1  |  <TaskInstance: dag.example4.get_data 
manual__2025-04-29T07:28:48.525595+00:00 [scheduled]>
   airflow-scheduler-1  | [2025-04-29T07:28:49.898+0000] 
{scheduler_job_runner.py:522} INFO - DAG dag.example4 has 0/16 running and 
queued tasks
   airflow-scheduler-1  | [2025-04-29T07:28:49.898+0000] 
{scheduler_job_runner.py:661} INFO - Setting the following tasks to queued 
state:
   airflow-scheduler-1  |  <TaskInstance: dag.example4.get_data 
manual__2025-04-29T07:28:48.525595+00:00 [scheduled]>
   airflow-scheduler-1  | [2025-04-29T07:28:49.901+0000] 
{scheduler_job_runner.py:767} INFO - Trying to enqueue tasks: [<TaskInstance: 
dag.example4.get_data manual__2025-04-29T07:28:48.525595+00:00 [scheduled]>] 
for executor: LocalExecutor(parallelism=64)
   airflow-scheduler-1  | [2025-04-29T07:28:49.917+0000] {local_executor.py:61} 
INFO - Worker starting up pid=72
   airflow-scheduler-1  | 2025-04-29 07:28:50 [info     ] Secrets backends 
loaded for worker [supervisor] backend_classes=['EnvironmentVariablesBackend'] 
count=1
   airflow-scheduler-1  | 
/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py:449
 DeprecationWarning: This process (pid=72) is multi-threaded, use of fork() may 
lead to deadlocks in the child.
   airflow-scheduler-1  | 2025-04-29 07:28:50 [warning  ] Starting call to 
'airflow.sdk.api.client.Client.request', this is the 1st time calling it. 
[airflow.sdk.api.client]
   airflow-scheduler-1  | 2025-04-29 07:28:51 [warning  ] Starting call to 
'airflow.sdk.api.client.Client.request', this is the 2nd time calling it. 
[airflow.sdk.api.client]
   airflow-scheduler-1  | 2025-04-29 07:28:52 [warning  ] Starting call to 
'airflow.sdk.api.client.Client.request', this is the 3rd time calling it. 
[airflow.sdk.api.client]
   airflow-scheduler-1  | 2025-04-29 07:28:54 [warning  ] Starting call to 
'airflow.sdk.api.client.Client.request', this is the 4th time calling it. 
[airflow.sdk.api.client]
   airflow-scheduler-1  | 2025-04-29 07:28:58 [info     ] Process exited        
         [supervisor] exit_code=<Negsignal.SIGKILL: -9> pid=73 
signal_sent=SIGKILL
   airflow-scheduler-1  | [2025-04-29T07:28:58.128+0000] {local_executor.py:96} 
ERROR - uhoh
   airflow-scheduler-1  | Traceback (most recent call last):
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_transports/default.py",
 line 69, in map_httpcore_exceptions
   airflow-scheduler-1  |     yield
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_transports/default.py",
 line 233, in handle_request
   airflow-scheduler-1  |     resp = self._pool.handle_request(req)
   airflow-scheduler-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py",
 line 256, in handle_request
   airflow-scheduler-1  |     raise exc from None
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpcore/_sync/connection_pool.py",
 line 236, in handle_request
   airflow-scheduler-1  |     response = connection.handle_request(
   airflow-scheduler-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpcore/_sync/connection.py",
 line 101, in handle_request
   airflow-scheduler-1  |     raise exc
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpcore/_sync/connection.py",
 line 78, in handle_request
   airflow-scheduler-1  |     stream = self._connect(request)
   airflow-scheduler-1  |              ^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpcore/_sync/connection.py",
 line 124, in _connect
   airflow-scheduler-1  |     stream = 
self._network_backend.connect_tcp(**kwargs)
   airflow-scheduler-1  |              
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpcore/_backends/sync.py", 
line 207, in connect_tcp
   airflow-scheduler-1  |     with map_exceptions(exc_map):
   airflow-scheduler-1  |          ^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File "/usr/local/lib/python3.12/contextlib.py", 
line 158, in __exit__
   airflow-scheduler-1  |     self.gen.throw(value)
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpcore/_exceptions.py", 
line 14, in map_exceptions
   airflow-scheduler-1  |     raise to_exc(exc) from exc
   airflow-scheduler-1  | httpcore.ConnectError: [Errno 111] Connection refused
   airflow-scheduler-1  |
   airflow-scheduler-1  | The above exception was the direct cause of the 
following exception:
   airflow-scheduler-1  |
   airflow-scheduler-1  | Traceback (most recent call last):
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/executors/local_executor.py",
 line 92, in _run_worker
   airflow-scheduler-1  |     _execute_work(log, workload)
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/executors/local_executor.py",
 line 113, in _execute_work
   airflow-scheduler-1  |     supervise(
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py",
 line 1313, in supervise
   airflow-scheduler-1  |     process = ActivitySubprocess.start(
   airflow-scheduler-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py",
 line 785, in start
   airflow-scheduler-1  |     proc._on_child_started(ti=what, 
dag_rel_path=dag_rel_path, bundle_info=bundle_info)
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py",
 line 796, in _on_child_started
   airflow-scheduler-1  |     ti_context = 
self.client.task_instances.start(ti.id, self.pid, start_date)
   airflow-scheduler-1  |                  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", 
line 146, in start
   airflow-scheduler-1  |     resp = 
self.client.patch(f"task-instances/{id}/run", content=body.model_dump_json())
   airflow-scheduler-1  |            
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 
1219, in patch
   airflow-scheduler-1  |     return self.request(
   airflow-scheduler-1  |            ^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
338, in wrapped_f
   airflow-scheduler-1  |     return copy(f, *args, **kw)
   airflow-scheduler-1  |            ^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
477, in __call__
   airflow-scheduler-1  |     do = self.iter(retry_state=retry_state)
   airflow-scheduler-1  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
378, in iter
   airflow-scheduler-1  |     result = action(retry_state)
   airflow-scheduler-1  |              ^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
420, in exc_check
   airflow-scheduler-1  |     raise retry_exc.reraise()
   airflow-scheduler-1  |           ^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
187, in reraise
   airflow-scheduler-1  |     raise self.last_attempt.result()
   airflow-scheduler-1  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
   airflow-scheduler-1  |     return self.__get_result()
   airflow-scheduler-1  |            ^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in 
__get_result
   airflow-scheduler-1  |     raise self._exception
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 
480, in __call__
   airflow-scheduler-1  |     result = fn(*args, **kwargs)
   airflow-scheduler-1  |              ^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", 
line 629, in request
   airflow-scheduler-1  |     return super().request(*args, **kwargs)
   airflow-scheduler-1  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 827, 
in request
   airflow-scheduler-1  |     return self.send(request, auth=auth, 
follow_redirects=follow_redirects)
   airflow-scheduler-1  |            
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 914, 
in send
   airflow-scheduler-1  |     response = self._send_handling_auth(
   airflow-scheduler-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 942, 
in _send_handling_auth
   airflow-scheduler-1  |     response = self._send_handling_redirects(
   airflow-scheduler-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 979, 
in _send_handling_redirects
   airflow-scheduler-1  |     response = self._send_single_request(request)
   airflow-scheduler-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 
1015, in _send_single_request
   airflow-scheduler-1  |     response = transport.handle_request(request)
   airflow-scheduler-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_transports/default.py",
 line 232, in handle_request
   airflow-scheduler-1  |     with map_httpcore_exceptions():
   airflow-scheduler-1  |          ^^^^^^^^^^^^^^^^^^^^^^^^^
   airflow-scheduler-1  |   File "/usr/local/lib/python3.12/contextlib.py", 
line 158, in __exit__
   airflow-scheduler-1  |     self.gen.throw(value)
   airflow-scheduler-1  |   File 
"/home/airflow/.local/lib/python3.12/site-packages/httpx/_transports/default.py",
 line 86, in map_httpcore_exceptions
   airflow-scheduler-1  |     raise mapped_exc(message) from exc
   airflow-scheduler-1  | httpx.ConnectError: [Errno 111] Connection refused
   airflow-scheduler-1  | [2025-04-29T07:28:59.128+0000] 
{scheduler_job_runner.py:810} INFO - Received executor event with state failed 
for task instance TaskInstanceKey(dag_id='dag.example4', task_id='get_data', 
run_id='manual__2025-04-29T07:28:48.525595+00:00', try_number=1, map_index=-1)
   ```
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   Install Airflow using the Docker images.
   Use the example DAG provided in this issue.
   
   ### Operating System
   
   Rocky Linux 9.5
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   Other DAGs work properly. For example:
   
   ```python
   import datetime
   
   from airflow.sdk import DAG
   from airflow.providers.standard.operators.empty import EmptyOperator
   
   with DAG(
           dag_id="dag.example1",
           start_date=datetime.datetime(2021, 1, 1),
           schedule="@hourly",
           ):
       a = EmptyOperator(task_id="a")
       b = EmptyOperator(task_id="b")
   
       a >> b
   ```
   
   Moreover, congratulations for Airflow 3! It looks really good and has some 
very nice new features!
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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