pkg/dxf: avoid misleading error log on context cancel#67612
pkg/dxf: avoid misleading error log on context cancel#67612ti-chi-bot[bot] merged 4 commits intopingcap:masterfrom
Conversation
|
@D3Hunter I've received your pull request and will start the review. I'll conduct a thorough review covering code quality, potential issues, and implementation details. ⏳ This process typically takes 10-30 minutes depending on the complexity of the changes. ℹ️ Learn more details on Pantheon AI. |
|
Hi @D3Hunter. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
📝 WalkthroughWalkthroughBaseTaskExecutor.Run now logs errors from runSubtask differently: context-cancellation errors (detected via Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/dxf/framework/taskexecutor/task_executor.go (1)
394-399: Include cancellation details in the Info log.At Line 396, the cancellation branch drops the error payload. Keep it at Info level, but include context (error and subtask ID) so cancellations remain diagnosable.
♻️ Suggested refinement
if err != nil { // task executor keeps running its subtasks even though some subtask // might have failed, we rely on scheduler to detect the error, and // notify task executor or manager to cancel. if llog.IsContextCanceledError(err) { // to avoid the log being misleading when context is canceled. - e.logger.Info("meet context cancel when run subtask") + e.logger.Info("context canceled when running subtask", + zap.Int64("subtask-id", subtask.ID), + zap.Error(err)) } else { e.logger.Error("run subtask failed", zap.Error(err)) } } else {As per coding guidelines, "Keep error handling actionable and contextual; avoid silently swallowing errors."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/dxf/framework/taskexecutor/task_executor.go` around lines 394 - 399, The cancellation branch drops the error payload; update the llog.IsContextCanceledError branch in the run-subtask handling (the code around llog.IsContextCanceledError and e.logger.Info("meet context cancel when run subtask")) to log the cancellation at Info level but include the error and subtask identifier (e.g., subtask.ID or other subtask identifier variable) so cancellations are diagnosable—replace the current e.logger.Info call with an Info log that adds zap.Error(err) and a field for the subtask ID (or use e.logger.InfoContext / With to attach context) while leaving non-cancellation errors unchanged in e.logger.Error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@pkg/dxf/framework/taskexecutor/task_executor.go`:
- Around line 394-399: The cancellation branch drops the error payload; update
the llog.IsContextCanceledError branch in the run-subtask handling (the code
around llog.IsContextCanceledError and e.logger.Info("meet context cancel when
run subtask")) to log the cancellation at Info level but include the error and
subtask identifier (e.g., subtask.ID or other subtask identifier variable) so
cancellations are diagnosable—replace the current e.logger.Info call with an
Info log that adds zap.Error(err) and a field for the subtask ID (or use
e.logger.InfoContext / With to attach context) while leaving non-cancellation
errors unchanged in e.logger.Error.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0ef1f38c-8a62-4ee9-b472-a1b1f2a13a00
📒 Files selected for processing (1)
pkg/dxf/framework/taskexecutor/task_executor.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #67612 +/- ##
================================================
+ Coverage 77.5859% 77.6573% +0.0714%
================================================
Files 1980 1965 -15
Lines 547705 550852 +3147
================================================
+ Hits 424942 427777 +2835
- Misses 121953 123064 +1111
+ Partials 810 11 -799
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
🔍 Starting code review for this PR... |
ingress-bot
left a comment
There was a problem hiding this comment.
This review was generated by AI and should be verified by a human reviewer.
Manual follow-up is recommended before merge.
Summary
- Total findings: 3
- Inline comments: 3
- Summary-only findings (no inline anchor): 0
Findings (highest risk first)
ℹ️ [Info] (1)
- Workaround comment explains logging effect but not cancellation contract (pkg/dxf/framework/taskexecutor/task_executor.go:395)
🧹 [Nit] (2)
- Cancellation log wording diverges from existing domain term (pkg/dxf/framework/taskexecutor/task_executor.go:396, pkg/dxf/framework/taskexecutor/task_executor.go:766)
- New cancellation log text introduces vocabulary drift (pkg/dxf/framework/taskexecutor/task_executor.go:396, pkg/dxf/framework/taskexecutor/task_executor.go:766)
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: D3Hunter, joechenrh, lance6716 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
1 similar comment
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
1 similar comment
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/retest |
1 similar comment
|
/retest |
|
@D3Hunter: PRs from untrusted users cannot be marked as trusted with DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherry-pick release-nextgen-202603 |
|
/cherry-pick release-nextgen-20251011 |
|
@D3Hunter: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
@D3Hunter: new pull request created to branch DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
What problem does this PR solve?
Issue Number: ref #67631
Problem Summary:
When a distributed task subtask exits because the context is canceled, the executor currently logs it as a failure. This produces misleading error logs for expected cancellation paths.
What changed and how does it work?
In
BaseTaskExecutor.Run, handlerunSubtaskerrors by type:llog.IsContextCanceledError(err)), log an info message.This preserves error visibility for real failures while reducing noisy/misleading logs for expected cancellations.
Check List
Tests
Side effects
Documentation
Release note
Summary by CodeRabbit