You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "kaxil (via GitHub)" <gi...@apache.org> on 2025/03/28 22:23:32 UTC

[PR] Fix Worker crash on API Server Error [airflow]

kaxil opened a new pull request, #48517:
URL: https://github.com/apache/airflow/pull/48517

   closes https://github.com/apache/airflow/issues/47873
   
   closes https://github.com/apache/airflow/issues/48503
   
   
   **Before**:
   
   The worker (or scheduler with `LocalExecutor`) fails and exits with the following error:
   
   <img width="1030" alt="image" src="https://github.com/user-attachments/assets/4911950b-11c0-4d2e-ba90-87ab355988b4" />
   
   <img width="764" alt="image" src="https://github.com/user-attachments/assets/c2f988cc-385e-4255-918a-0fa853a422b5" />
   
   
   **After**:
   
   <img width="1715" alt="image" src="https://github.com/user-attachments/assets/5ea583bb-5b45-42ad-b990-591aa194db86" />
   
   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
   


-- 
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: [PR] Fix Worker crash on API Server Error [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil merged PR #48517:
URL: https://github.com/apache/airflow/pull/48517


-- 
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: [PR] Fix Worker crash on API Server Error [airflow]

Posted by "jguthrie100 (via GitHub)" <gi...@apache.org>.
jguthrie100 commented on PR #48517:
URL: https://github.com/apache/airflow/pull/48517#issuecomment-4429747152

   Has this already been released in a production release? I'm getting the same error running Airflow 3.2.1


-- 
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: [PR] Fix Worker crash on API Server Error [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on code in PR #48517:
URL: https://github.com/apache/airflow/pull/48517#discussion_r3017120095


##########
task-sdk/tests/task_sdk/api/test_client.py:
##########
@@ -865,3 +889,33 @@ def handle_request(request: httpx.Request) -> httpx.Response:
 
         assert isinstance(result, TaskRescheduleStartDate)
         assert result.start_date == "2024-01-01T00:00:00Z"
+
+
+# def test_server_response_error_pickling():
+#     """Test that ServerResponseError can be pickled and unpickled."""
+#     def handle_request(request: httpx.Request) -> httpx.Response:
+#         return httpx.Response(
+#             status_code=400,
+#             request=request,
+#             json={"detail": {"message": "Invalid input"}},
+#         )
+#
+#     client = make_client(transport=httpx.MockTransport(handle_request))
+#
+#     # Create an error by making a request that will fail
+#     with pytest.raises(ServerResponseError) as exc_info:
+#         client.get("http://fake-url-for-testing")
+#
+#     err = exc_info.value
+#
+#     # Pickle and unpickle
+#     pickled = pickle.dumps(err)
+#     unpickled = pickle.loads(pickled)
+#
+#     assert isinstance(unpickled, ServerResponseError)
+#
+#     # Error message from response
+#     assert unpickled.response.json() == {"detail": {"message": "Invalid input"}}
+#     assert unpickled.detail == {"detail": {"message": "Invalid input"}}
+#     assert unpickled.response.status_code == 400
+#     assert unpickled.request.url == "http://fake-url-for-testing"

Review Comment:
   This was removed



-- 
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: [PR] Fix Worker crash on API Server Error [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on PR #48517:
URL: https://github.com/apache/airflow/pull/48517#issuecomment-2762760743

   > I mean okay, but what is actually using pickle in our path?
   > 
   > What is trying to pickle the exception in the first place
   
   It is coming from Local Executor, specifically the following block:
   
    https://github.com/apache/airflow/blob/831f12ad7e2cff25c8007583521d664a5e9f21e6/airflow-core/src/airflow/executors/local_executor.py#L91-L97
   
   
   When a task fails with an exception, the exception is put into the r`esult_queue` as part of a tuple with the task key and state.
   
   Later, in _read_results, the executor tries to read from this queue, and it fails!!:
   
   https://github.com/apache/airflow/blob/831f12ad7e2cff25c8007583521d664a5e9f21e6/airflow-core/src/airflow/executors/local_executor.py#L208-L210


-- 
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: [PR] Fix Worker crash on API Server Error [airflow]

Posted by "kaxil (via GitHub)" <gi...@apache.org>.
kaxil commented on PR #48517:
URL: https://github.com/apache/airflow/pull/48517#issuecomment-2762782380

   This should hold us for now, I have another fix in mind -- just a little more involved


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