Repository navigation
Fix TypeError when a task log event has a key named target or msg - #75029
Open
liwenjie200543 wants to merge 3 commits into
Open
liwenjie200543 wants to merge 3 commits into
liwenjie200543 wants to merge 3 commits into
Conversation
The supervisor spreads every remaining key of a subprocess log event into `_log_to_target(target, level, msg, **event)`; an event carrying a key named `target` or `msg` collided with the helper parameters and raised a TypeError that escaped the supervisor loop, orphaning the task process and recording a successful task as failed. Make the first three parameters positional-only so event keys are always forwarded as kwargs, and add a regression test. Fixes: apache#75017
FrankYang0529
approved these changes
Oct 22, 2026
FrankYang0529
left a comment
Member
There was a problem hiding this comment.
LGTM. Leave one minor comment. Thanks.
Contributor
Author
|
@FrankYang0529 thanks again — the test is now parametrized ( I've also updated the branch onto current GitHub dropped the earlier approval because of that follow-up push, so |
This branch has not been deployed
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.
What
process_log_messages_from_subprocessspreads every remaining key of a subprocess log event into_log_to_target(target, level, msg, **event). A log event carrying a key namedtargetormsgcollides with the helper's own parameter names and raisesTypeError. Nothing in the supervisor loop catches it, so the heartbeat stops, the child process (in its own process group) is never killed, and a successful task is recorded as failed — the repro and trace are in the issue.This makes the first three parameters positional-only (
/), so event keys can no longer collide with them and every key is forwarded as a kwarg. Non-reserved keys (environment=etc.) behave exactly as before.Checks
target=/msg=events raisedTypeErrorbefore the change and are forwarded unchanged after it; a real structlog logger renderstarget=prod/msg=prodas expected._log_to_targethas two call sites (process_log_messages_from_subprocessandforward_to_log), both pass the first three arguments positionally, so the/marker changes no existing call.Fixes: #75017