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

   ### Apache Airflow version
   
   3.0.0
   
   ### If "Other Airflow 2 version" selected, which one?
   
   current main
   
   ### What happened?
   
   I encountered this passing an embedding vector (list of lists) as XCom using 
a dag that works in 2.10.  The below dag reproduces the issue:
   
   ```
   from airflow.sdk import dag
   from airflow.decorators import task 
   
   @dag() 
   def lazy_list_xcom():
   
       @task 
       def create_long_list():
           big_list = [[i for i in range(100)] for _ in range(1000)]
           return big_list
       
       @task
       def print_list(x):
           print(x)
   
   
       print_list(create_long_list())
   
   
   lazy_list_xcom()
   ```
   
   When running this dag the `create_long_list` task finishes successfully and 
the `print_list` task gets stuck in running state (without any error that I can 
see in the components). 
   
   Once I clear the `print_list` task I get the following error in the logs:
   
   ```
   Log message source details: 
sources=["/root/airflow/logs/dag_id=lazy_list_xcom/run_id=manual__2025-04-06T18:45:31.764375+00:00/task_id=print_list/attempt=1.log"]
   
[[2](http://localhost:28080/dags/lazy_list_xcom/runs/manual__2025-04-06T18:45:31.764375+00:00/tasks/print_list?try_number=1#2)025-04-06,
 18:45:33] INFO - DAG bundles loaded: dags-folder: 
source="airflow.dag_processing.bundles.manager.DagBundlesManager"
   [2025-04-06, 
18:45:[3](http://localhost:28080/dags/lazy_list_xcom/runs/manual__2025-04-06T18:45:31.764375+00:00/tasks/print_list?try_number=1#3)3]
 INFO - Filling up the DagBag from /files/dags/lazy_list_xcom.py: 
source="airflow.models.dagbag.DagBag"
   [2025-04-06, 
18:[4](http://localhost:28080/dags/lazy_list_xcom/runs/manual__2025-04-06T18:45:31.764375+00:00/tasks/print_list?try_number=1#4)6:53]
 ERROR - Exception rendering Jinja template for task 'print_list', field 
'op_args'. Template: (XComArg(<Task(_PythonDecoratedOperator): 
create_long_list>),): 
source="airflow.sdk.definitions._internal.abstractoperator"
   RuntimeError: Direct database access via the ORM is not allowed in Airflow 
3.0
   File 
"/opt/airflow/task-sdk/src/airflow/sdk/definitions/_internal/abstractoperator.py",
 line 379 in _do_render_template_fields
   
   File 
"/opt/airflow/task-sdk/src/airflow/sdk/definitions/_internal/templater.py", 
line 193 in render_template
   
   File 
"/opt/airflow/task-sdk/src/airflow/sdk/definitions/_internal/templater.py", 
line 193 in <genexpr>
   
   File 
"/opt/airflow/task-sdk/src/airflow/sdk/definitions/_internal/templater.py", 
line 189 in render_template
   
   File "/opt/airflow/task-sdk/src/airflow/sdk/definitions/xcom_arg.py", line 
345 in resolve
   
   File "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py", 
line 348 in xcom_pull
   
   File "/opt/airflow/task-sdk/src/airflow/sdk/bases/xcom.py", line 256 in 
get_one
   
   File "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py", 
line 564 in get_message
   
   File "/opt/airflow/airflow-core/src/airflow/jobs/scheduler_job_runner.py", 
line 227 in _exit_gracefully
   
   File "/opt/airflow/airflow-core/src/airflow/utils/session.py", line 101 in 
wrapper
   
   File "/usr/local/lib/python3.9/contextlib.py", line 119 in __enter__
   
   File "/opt/airflow/airflow-core/src/airflow/utils/session.py", line 41 in 
create_session
   
   File "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/supervisor.py", 
line 218 in __init__
   ```
   
   The movie:
   
   
https://github.com/user-attachments/assets/a320951f-b3ac-4d76-99d3-deb6949479cb
   
   ### What you think should happen instead?
   
   The task should run successfully and print the list of lists.
   
   ### How to reproduce
   
   Run the dag above. See the second task get stuck. Then clear the task to see 
the database access error.
   
   ### Operating System
   
   MacOs
   
   ### Versions of Apache Airflow Providers
   
   latest main
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   breeze
   
   ### Anything else?
   
   I think this might be an issue that occurs dependent on lazy xcom access... 
small XComs work fine.
   
   ### 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