Bugfix/63173 k8s unicode log read#63673
Merged
jscheffl merged 6 commits intoapache:mainfrom Mar 16, 2026
Merged
Conversation
…read_logs When pod output contains non-UTF-8 bytes (e.g. binary data from tqdm progress bars, truncated multi-byte sequences at chunk boundaries), kubernetes_asyncio's internal decode raises UnicodeDecodeError, crashing the entire task. Catch UnicodeDecodeError and retry with _preload_content=False to get raw bytes, then decode with errors='replace' so logging continues without killing the task. Closes apache#63173
6e01601 to
96eb41c
Compare
eladkal
approved these changes
Mar 16, 2026
AutomationDev85
approved these changes
Mar 16, 2026
Contributor
AutomationDev85
left a comment
There was a problem hiding this comment.
Like to this is now also fixed in the Kubernetes use case.
fat-catTW
pushed a commit
to fat-catTW/airflow
that referenced
this pull request
Mar 22, 2026
* fix(providers/k8s): handle UnicodeDecodeError in AsyncKubernetesHook.read_logs When pod output contains non-UTF-8 bytes (e.g. binary data from tqdm progress bars, truncated multi-byte sequences at chunk boundaries), kubernetes_asyncio's internal decode raises UnicodeDecodeError, crashing the entire task. Catch UnicodeDecodeError and retry with _preload_content=False to get raw bytes, then decode with errors='replace' so logging continues without killing the task. Closes apache#63173 * Fix mypy * Fix pytest in GKE * Fix pytest in GKE, use AsyncMock * Fix pytest in GKE, fix assert --------- Co-authored-by: Yoann Abriel <yoann.abriel@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up of PR #63282 by @YoannAbriel - thanks for the pre-work!
As this issue is kind of important to us, I am following-up on a fix for the problem. Took over the commits into a new branch/PR and fixing mypy and pytests. Hope getting it green and to main now.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.