You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "arkadiuszbach (via GitHub)" <gi...@apache.org> on 2025/11/06 11:47:27 UTC

[I] Error details missing in the logs for internal SDK API calls [airflow]

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

   ### Apache Airflow version
   
   3.1.2
   
   ### If "Other Airflow 2/3 version" selected, which one?
   
   3.1.1
   
   ### What happened?
   
   For some internal sdk api client calls error details are not printed in the logs, only stacktrace with **airflow.sdk.api.client.ServerResponseError: Server returned error**, see below: 
   
   ```
   2025-11-05T17:32:56.233876Z [error    [] Task execute_workload[b4c1c834-0c96-4387-b5e7-1f159fd0afd3[] raised unexpected: ServerResponseError('Server returned error') [celery.app.trace] loc=trace.py:267
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.12/site-packages/celery/app/trace.py", line 453, in trace_task
       R = retval = fun(*args, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/celery/app/trace.py", line 736, in __protected_call__
       return self.run(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/celery/executors/celery_executor_utils.py", line 174, in execute_workload
       supervise(
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 1926, in supervise
       process = ActivitySubprocess.start(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 950, in start
       proc._on_child_started(ti=what, dag_rel_path=dag_rel_path, bundle_info=bundle_info)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/execution_time/supervisor.py", line 961, in _on_child_started
       ti_context = self.client.task_instances.start(ti.id, self.pid, start_date)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 210, in start
       resp = self.client.patch(f"task-instances/{id}/run", content=body.model_dump_json())
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 1218, in patch
       return self.request(
              ^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 338, in wrapped_f
       return copy(f, *args, **kw)
              ^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 477, in __call__
       do = self.iter(retry_state=retry_state)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 378, in iter
       result = action(retry_state)
                ^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 400, in <lambda>
       self._add_action_func(lambda rs: rs.outcome.result())
                                        ^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/concurrent/futures/_base.py", line 449, in result
       return self.__get_result()
              ^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
       raise self._exception
     File "/home/airflow/.local/lib/python3.12/site-packages/tenacity/__init__.py", line 480, in __call__
       result = fn(*args, **kwargs)
                ^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 866, in request
       return super().request(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 825, in request
       return self.send(request, auth=auth, follow_redirects=follow_redirects)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 914, in send
       response = self._send_handling_auth(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 942, in _send_handling_auth
       response = self._send_handling_redirects(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 999, in _send_handling_redirects
       raise exc
     File "/home/airflow/.local/lib/python3.12/site-packages/httpx/_client.py", line 982, in _send_handling_redirects
       hook(response)
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 181, in raise_on_4xx_5xx_with_note
       return get_json_error(response) or response.raise_for_status()
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/home/airflow/.local/lib/python3.12/site-packages/airflow/sdk/api/client.py", line 171, in get_json_error
       raise err
   airflow.sdk.api.client.ServerResponseError: Server returned error
   Correlation-id=019a5514-2a01-7556-862b-11cee90b65c9
   ```
   
   Seems its because of this change: https://github.com/apache/airflow/pull/51079 - if the code that is calling the sdk is simply reraising the exception  without printing `error.details` then the details are missing as the `log.warning("Server error", detail=err.detail)` has been removed from `get_json_error`
   
   - here exception is handled for client.get(f"variables/{key}") and error.detail printed: https://github.com/apache/airflow/blob/cdb1e23344c9ecfe36efea235c6da456d2bdb9b1/task-sdk/src/airflow/sdk/api/client.py#L396 - 
   - but here, it is simply reraised hence the missing error details for client.task_instances.start
   https://github.com/apache/airflow/blob/cdb1e23344c9ecfe36efea235c6da456d2bdb9b1/task-sdk/src/airflow/sdk/execution_time/supervisor.py#L975 - 
   
   ### What you think should happen instead?
   
   Error details printed for all sdk calls
   
   ### How to reproduce
   
   Not sure yet, was killing redis to test how Airflow will behave when its down
   
   ### Operating System
   
   k8s
   
   ### 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
   
   - [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: commits-unsubscribe@airflow.apache.org.apache.org

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


Re: [I] Error details missing in the logs for internal SDK API calls [airflow]

Posted by "pierrejeambrun (via GitHub)" <gi...@apache.org>.
pierrejeambrun closed issue #57961: Error details missing in the logs for internal SDK API calls
URL: https://github.com/apache/airflow/issues/57961


-- 
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: commits-unsubscribe@airflow.apache.org

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


Re: [I] Error details missing in the logs for internal SDK API calls [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #57961:
URL: https://github.com/apache/airflow/issues/57961#issuecomment-3496804351

   Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
   


-- 
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: commits-unsubscribe@airflow.apache.org

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


Re: [I] Error details missing in the logs for internal SDK API calls [airflow]

Posted by "chandakanant (via GitHub)" <gi...@apache.org>.
chandakanant commented on issue #57961:
URL: https://github.com/apache/airflow/issues/57961#issuecomment-5678688785

   Hi @arkadiuszbach & @pierrejeambrun, is this issue solved by upgrading Airflow to 3.2.0? I am also facing the above issue.
   
   I have 2 Airflow environments, i.e., staging and production. Staging Airflow is working fine, but in production I am getting the above error when running multiple DAGs with multiple tasks. Both have the same configurations.
   
   config:
     api: 
       base_url: "${var.environment == "production" ? "https://airflow.${var.region}a.com" : "https://airflow.${var.region}a.${var.environment}.com"}"
       worker_timeout: 600
     api_auth:
       jwt_secret: "airflow-jwt-secret"
     webserver:
       page_size: 25
       base_url: "${var.environment == "production" ? "https://airflow.${var.region}a.com" : "https://airflow.${var.region}a.${var.environment}.com"}"
     core:
       dags_folder: /opt/airflow/dags/repo/dags_us
       max_active_tasks_per_dag: 50
       max_active_runs_per_dag: 16
       dagbag_import_timeout: 600
       non_pooled_task_slot_count: 1000
       dag_concurrency: 10000
       parallelism: 500
       default_pool_task_slot_count: 1000
       default_timezone: "utc"
     dag_processor:
       min_file_process_interval: 120
     logging:
       fab_logging_level: "ERROR"
       logging_level: "INFO"
     database:
       sql_alchemy_max_overflow: 50
       sql_alchemy_pool_enabled: true
       sql_alchemy_pool_pre_ping: true
       sql_alchemy_pool_recycle: 600
       sql_alchemy_pool_size: 300
     scheduler:
       dag_file_processor_timeout : 1000
       enable_health_check: true
       job_heartbeat_sec: 300
       max_dagruns_per_loop_to_schedule: 175
       max_dagruns_to_create_per_loop: 175
       max_tis_per_query: 300
       scheduler_health_check_threshold: 120
       scheduler_zombie_task_threshold: 300
     kubernetes_executor: 
       worker_pods_creation_batch_size : 1000
       delete_worker_pods: true
       delete_worker_pods_on_failure: false


-- 
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: commits-unsubscribe@airflow.apache.org

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