Repository navigation
Bound the pod log read in Task readOutputs - #1798
Merged
Merged
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
Turn on auto-fix | Re-trigger cubic
readOutputs streamed a finished pod's log tail with the reconcile context, which has no deadline. If the log stream to the API server hangs, the call never returns and the Task controller's single worker stops reconciling every Task until the controller restarts. Wrap the log request in a 15s timeout. A failed read already returns no outputs, and the existing output retry tries again.
sperano
force-pushed
the
fix/task-log-read-timeout
branch
from
October 7, 2026 02:35
ad772f1 to
e2b9d03
Compare
Collaborator
|
the bug seems serious. Thanks for the report. /kelos review |
Contributor
|
🤖 Kelos Task Status Task |
Contributor
|
🤖 Kelos Reviewer Agent @gjkim42 Review SummaryVerdict: APPROVE Findings Overview
FindingsNo qualifying findings. Reviewed against PR head
Suggestions (optional)
Key takeaways
|
This branch was successfully 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 type of PR is this?
/kind bug
What this PR does / why we need it:
TaskReconciler.readOutputsreads the tail of a finished pod's log through the reconcile context. That context has no deadline. If the API server never answers the log request,Stream()blocks forever. The Task controller runs a single worker, so from then on no Task is reconciled.We hit this in production on v0.58.0. For 108 minutes, newly created Tasks stayed at
status: null, with no finalizer and no Job. The controller pod stayed Running and Ready, so nothing flagged the problem. Only a restart ofkelos-controller-managercleared it.A goroutine dump taken with SIGQUIT showed the only Task worker blocked in
readOutputs. Its HTTP/2 request goroutine had already written the request and was waiting for response headers that never came:Goroutine dump (trimmed)
Both of those waits also return when the request context is cancelled. This PR wraps the context in
readOutputswith a 15s timeout (podLogReadTimeout), which bounds bothStream()and the body read. When the read fails,readOutputsreturns no outputs, as it already does for any log error, and the existing output retry (outputRetryWindow/outputRetryInterval) tries again.Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
TestReadOutputsParsesLogTailcovers the happy path. A real clientset is pointed at anhttptestserver, and the test checks the request path, container andtailLines, plus the parsed outputs and results.TestReadOutputsTimesOutOnHungLogStreamuses a server that accepts the request and never responds, the same state as in the dump. It checks thatreadOutputsreturns no outputs within the timeout. The test fails against the code before this change.podLogReadTimeoutis a package variable so the test can shorten it to 100ms; the production value is 15s.WorkerPoolReconciler.readPodOutputshas the same unbounded log read. I left it out to keep this change focused, and I'm happy to follow up.make update(no changes),make verify,make test,make test-integrationandmake build. All pass.Does this PR introduce a user-facing change?