Commit 740855a
* Don't crash supervisor IPC loop on transient network errors
handle_requests in the supervisor only caught ServerResponseError. Any
non-HTTP exception (httpx.ConnectError, httpx.TimeoutException, socket
timeouts, etc.) would propagate, terminate the generator, and
permanently break the supervisor-to-task IPC channel. The task
subprocess would then get EOFError on every subsequent send, and the
worker would be stuck waiting for replies that never come.
Add a catch-all except Exception after the ServerResponseError handler
that logs the unhandled exception with type info, sends a best-effort
ErrorResponse(API_SERVER_ERROR, ...) back to the task so the failure
surfaces in task logs (wrapped in suppress(Exception) because if we
can't reach the task subprocess via stdin we shouldn't double-fault),
and lets the request loop continue to the next request.
Test added: a fake httpx.ConnectError on the first call produces an
ErrorResponse, the generator stays alive, and a second request is
processed normally (the loop is not dead).
Reported by the L3 ASVS sweep at apache/tooling-agents#24 (FINDING-005).
* Address review comments: shorten comment and use exc_info
- Shorten the catch-all comment per amoghrajesh's suggestion.
- Use exc_info=e in log.exception instead of exception_type field
per jason810496's suggestion (exception type is redundant since
the exception itself is logged with full type info and traceback).
(cherry picked from commit 1e5d799)
Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
1 parent 3a734dd commit 740855a
2 files changed
Lines changed: 62 additions & 0 deletions
File tree
- task-sdk
- src/airflow/sdk/execution_time
- tests/task_sdk/execution_time
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
760 | 760 | | |
761 | 761 | | |
762 | 762 | | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
763 | 785 | | |
764 | 786 | | |
765 | 787 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2753 | 2753 | | |
2754 | 2754 | | |
2755 | 2755 | | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
| 2768 | + | |
| 2769 | + | |
| 2770 | + | |
| 2771 | + | |
| 2772 | + | |
| 2773 | + | |
| 2774 | + | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
2756 | 2796 | | |
2757 | 2797 | | |
2758 | 2798 | | |
| |||
0 commit comments