Skip to content

[v3-3-test] Fix triggerer CrashLoopBackOff when json_logs is enabled (#68584) - #70669

Merged
potiuk merged 2 commits into
v3-3-testfrom
backport-ebe6c58-v3-3-test
Jul 30, 2026
Merged

[v3-3-test] Fix triggerer CrashLoopBackOff when json_logs is enabled (#68584)#70669
potiuk merged 2 commits into
v3-3-testfrom
backport-ebe6c58-v3-3-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor
  • Fix triggerer CrashLoopBackOff when json_logs is enabled

TriggerRunnerSupervisor._process_log_messages_from_subprocess primes itself
by calling airflow.sdk.log.configure_logging() with no arguments. json_output
defaults to False, so this reconfigures structlog globally and installs the
text WriteLogger factory -- overwriting the bytes BytesLogger factory that
startup set up from json_logs=True.

The stdout/stderr forwarders (_create_log_forwarder -> forward_to_log) were
already wrapped with the JSON (bytes) processor chain but bind their underlying
logger lazily. As soon as a trigger subprocess writes to stdout/stderr -- for
example an import-time warning from a provider trigger that pulls in a heavy
client (kubernetes, boto3) -- the lazy bind resolves against the now-text
factory and WriteLogger.msg does message + "\n" on bytes from the JSON
renderer, raising TypeError: can't concat str to bytes and crash-looping the
triggerer.

Pass json_output from the logging.json_logs config so the global structlog
factory stays consistent with the rest of the process.

  • Add newsfragment

  • Refactor docstring for test_process_log_messages_configures_logging

Updated the docstring to clarify the behavior of _process_log_messages_from_subprocess() regarding JSON logging configuration.

  • Delete airflow-core/newsfragments/68584.bugfix.rst

  • Remove comments about logging configuration

Removed comments explaining the configure_logging function's behavior with json_logs setting.
(cherry picked from commit ebe6c58)

Co-authored-by: safaehar safae.hariri@datadoghq.com

…68584)

* Fix triggerer CrashLoopBackOff when json_logs is enabled

TriggerRunnerSupervisor._process_log_messages_from_subprocess primes itself
by calling airflow.sdk.log.configure_logging() with no arguments. json_output
defaults to False, so this reconfigures structlog globally and installs the
text WriteLogger factory -- overwriting the bytes BytesLogger factory that
startup set up from json_logs=True.

The stdout/stderr forwarders (_create_log_forwarder -> forward_to_log) were
already wrapped with the JSON (bytes) processor chain but bind their underlying
logger lazily. As soon as a trigger subprocess writes to stdout/stderr -- for
example an import-time warning from a provider trigger that pulls in a heavy
client (kubernetes, boto3) -- the lazy bind resolves against the now-text
factory and WriteLogger.msg does `message + "\n"` on bytes from the JSON
renderer, raising `TypeError: can't concat str to bytes` and crash-looping the
triggerer.

Pass json_output from the logging.json_logs config so the global structlog
factory stays consistent with the rest of the process.

* Add newsfragment

* Refactor docstring for test_process_log_messages_configures_logging

Updated the docstring to clarify the behavior of `_process_log_messages_from_subprocess()` regarding JSON logging configuration.

* Delete airflow-core/newsfragments/68584.bugfix.rst

* Remove comments about logging configuration

Removed comments explaining the configure_logging function's behavior with json_logs setting.
(cherry picked from commit ebe6c58)

Co-authored-by: safaehar <safae.hariri@datadoghq.com>
@potiuk
potiuk merged commit 65563f5 into v3-3-test Jul 30, 2026
76 checks passed
@potiuk
potiuk deleted the backport-ebe6c58-v3-3-test branch July 30, 2026 19:26
@github-actions github-actions Bot added this to the Airflow 3.3.2 milestone Jul 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.2 based on: bug fix merged to version branch
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Triggerer type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants