You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/04/17 14:45:31 UTC

[GitHub] [airflow] michaelosthege commented on issue #12813: Attempting to read an xcom produced by KubernetesPodOperator results in UnicodeDecodeError

michaelosthege commented on issue #12813:
URL: https://github.com/apache/airflow/issues/12813#issuecomment-821833783


   We're getting the same error in Airflow 2.0.1 and it happens with xcom produced by the `PythonOperator` too.
   
   Tasks that try to `xcom_pull` upstream results that were created **before** the 1.0.14 → 2.0.1 migration break (see below).
   Pulling upstream XCom results that were created **after** the 2.0.1 upgrade works just fine.
   
   ```
   [2021-04-17 14:28:35,344] {taskinstance.py:1455} ERROR - 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
   Traceback (most recent call last):
     File "/opt/conda/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1112, in _run_raw_task
       self._prepare_and_execute_task_with_callbacks(context, task)
     File "/opt/conda/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1285, in _prepare_and_execute_task_with_callbacks
       result = self._execute_task(context, task_copy)
     File "/opt/conda/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1315, in _execute_task
       result = task_copy.execute(context=context)
     File "/opt/conda/lib/python3.7/site-packages/airflow/operators/python.py", line 117, in execute
       return_value = self.execute_callable()
     File "/opt/conda/lib/python3.7/site-packages/airflow/operators/python.py", line 128, in execute_callable
       return self.python_callable(*self.op_args, **self.op_kwargs)
     File "/usr/local/airflow/dags/flow.py", line 91, in _run
       upstream_result = task_instance.xcom_pull(task_ids=[taskid])[0]
     File "/opt/conda/lib/python3.7/site-packages/airflow/utils/session.py", line 65, in wrapper
       return func(*args, session=session, **kwargs)
     File "/opt/conda/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1960, in xcom_pull
       for result in query.with_entities(XCom.task_id, XCom.value)
     File "/opt/conda/lib/python3.7/site-packages/airflow/models/taskinstance.py", line 1960, in <dictcomp>
       for result in query.with_entities(XCom.task_id, XCom.value)
     File "/opt/conda/lib/python3.7/site-packages/airflow/models/xcom.py", line 255, in deserialize_value
       return json.loads(result.value.decode('UTF-8'))
   UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte
   ```
   
   Interestingly the XCom data shows up just fine on the webserver:
   ![grafik](https://user-images.githubusercontent.com/5894642/115116739-8f6d8a00-9f9b-11eb-9094-df2d83572795.png)
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org