ISSUE DESCRIPTION Admitted workloads are requeued too early when a worker disconnects An…
- User
ISSUE DESCRIPTION
Admitted workloads are requeued too early when a worker disconnects
An admitted workload must remain ready during a temporary worker disconnect and be retried only after the configured worker-loss timeout. Reconnection with the same configuration must restore processing without affecting other connected workers.
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /kueue, current file: none) bash-$
Assistant
Let me start by exploring the repository structure to understand what we're working with.
Assistant
This is the Kueue project. The issue mentions "worker disconnects" and "worker-loss timeout", which sounds like MultiKueue. Let me explore.
Assistant
Let me look at the
reconcileGroupand related functions in the workload.go file.Assistant
Let me look at the
multikueuecluster.goto understand the connection state and the wlUpdateCh mechanism.Assistant
Let me look at the watch handling portion of multikueuecluster.go.
Assistant
Let me look at the workload_test.go to understand the expected behavior and existing test scenarios.
Assistant
Now let me look at how the test setup works, particularly
worker2Reconnecting, and how the reconciler test sets things up. Let me look at the test driver function (runReconcile/verify).Assistant
Let me look at the
controllerFormethod and the clustersReconciler structure.Assistant
Let me look at the full
setConfigmethod and howconnectingis managed.Assistant
Let me look at the "reconnecting clients are skipped" test case and search for related integration tests.
Assistant
Let me look at the integration tests for multikueue worker loss behavior.
Assistant
Let me look at the
BreakConnectionutility and thedefaultWorkerLostTimeoutconstant.Assistant
Let me look at the e2e multikueue test about worker loss.
Assistant
Let me look at the rest of the clustersReconciler.Reconcile to understand how connection loss / config failures are handled.
Assistant
Let me look at the multikueuecluster_test.go to understand how remoteClient clock and reconnect state are tested.
Assistant
Let me look at controllers.go for the reconciler setup and the workerLostTimeout option.
Assistant
Now let me check the
workload.ClusterNamehelper and look at the exact else-branch code again with line numbers.Assistant
Now let me look at the exact else-branch lines in workload.go to plan the edit.
Assistant
Now I have a clear understanding. Let me implement the fix. First, let me view the
remoteClientstruct definition with line numbers.Assistant
Now let me add the
connectionLostAtfield to the struct. Let me edit:Assistant
Now let me make the edits. First, add the
connectionLostAtfield:Assistant
Now add the helper methods after
resetFailedConnAttempt. Let me addmarkConnectionLost,clearConnectionLost, andgetConnectionLostAt:Assistant
Now update
newRemoteClientto record the initial disconnect time (handles manager restart scenario):Assistant
Now update
setConfigto clear the disconnect time on successful reconnect:Assistant
Now update the
startWatchergoroutine to record the disconnect time on watch drop:Assistant
Now update the else branch in
reconcileGroupin workload.go:Assistant
Let me verify the build compiles:
Assistant
Build passes. Now let me run the existing unit tests for this package:
Assistant
Let me write a temporary reproduction test to verify the fix for the disconnect scenario. First, let me check the test helpers available.
Assistant
Let me create a temporary reproduction test to verify the new behavior:
Assistant
Now let me create a temporary test file to verify the new behavior:
Assistant
The error "no active clusters" occurs because with a single disconnected worker,
remoteClientsForACreturns empty. The else branch is only reached in the multi-worker case. Let me update my test to use two workers (reserving one disconnected, another connected):Assistant
Let me verify the test would fail with the OLD behavior (to confirm it exercises the bug). Let me temporarily revert the workload.go change:
Assistant
The test confirms the bug exists with the old behavior (recent disconnect → wrongly Retry). Now let me restore my fix:
Assistant
Fix restored and passing. Now let me remove the temporary test file and run the full package test suite plus the broader multikueue tests:
Assistant
Let me run the multikueuecluster tests (which exercise setConfig/reconnect) and verify the reconnect backoff test still passes:
Assistant
Let me run
go vetand the full pkg test suite to ensure nothing is broken:Assistant
All tests pass and vet is clean. Let me check there were no failures above (the output shows all "ok" and "no test files"). Let me grep for FAIL.
Assistant
No actual failures (the match is just the
failurerecoverypackage name). Let me review my complete changes:Assistant
Let me check the CHANGELOG directory convention to see if I should add an entry:
Assistant
Let me check if there are other places that set
connectingto true that I might have missed:Assistant
Both places are covered:
- Line 170 (newRemoteClient): markConnectionLost called right after.
- Line 423 (startWatcher watch drop): markConnectionLost called in the
!oldConnectingblock.
Good. Now, are there places that set connecting=false that I should clear connectionLostAt? Let me check.
Assistant
Let me run the multikueue unit tests once more (fresh) and build the whole project:
Assistant
Let me check whether integration tests can be run (envtest setup):
Assistant
Setting up envtest would require downloading binaries (network). The instructions say not to search the internet. Installing envtest assets would need network access. Let me check if there's already a setup-envtest and assets available.
Let me try to install setup-envtest and download assets. Actually, this may not work offline. Let me check if there's a cached envtest.
Assistant
No envtest assets available, and network may not be accessible. Let me try to install setup-envtest and use it; if it fails (no network), I'll skip integration tests since unit tests already validate the fix.
Let me attempt the envtest setup quickly.
Assistant
envtest assets downloaded. Let me try running the specific integration test about worker loss to confirm it still passes:
Assistant
The integration test setup is heavy (multiple envtest clusters). Let me run it in the background and poll for results:
Assistant
Still no output after 2 minutes. Let me check whether the test process is running and if it's compiling.
Assistant
There are envtest clusters spinning up. Let me wait more for the multikueue suite (3 clusters):
Assistant
The log is buffered (Go test buffers output until completion). Let me wait longer for the heavy suite:
Assistant
The test is taking ~10 min with buffered output. Let me check resource state and wait a bit more:
Assistant
The integration test hit the 600s go-test timeout and dumped goroutine stacks (heavy suite + possible stale envtest processes from a prior run). Let me check the head of the log:
Assistant
The suite hung during cluster creation (test infrastructure), not in my code — likely due to stale envtest processes from a prior failed run. Let me clean up and retry with a longer timeout:
Assistant
These are zombie processes (harmless). Let me find and reap their parent:
Assistant
The zombies are harmless (reparented to init). Let me look at
createClusterto understand the hang, then retry with a longer timeout:Assistant
The hang was environmental (the
Init()blocking, likely due to stale processes). Now they're dead. Let me retry with a longer timeout in the background:Assistant
No log output yet after 90s (still compiling + BeforeSuite). Let me wait more.
Assistant
Still only 1 line in the log after 5:49 (likely just "nohup: ignoring input" + buffering). The grep returned nothing matching my patterns — meaning the buffered ginkgo output isn't flushed. Let me check raw content.
Assistant
Only 1 apiserver after ~6 min — cluster creation is slow/stuck again (environment issue). Let me check the running test's goroutine state:
Assistant
Let me wait for the SIGQUIT stack dump:
Assistant
The SIGQUIT didn't produce output in the log either — maybe the SIGQUIT went to the wrong process (the go test wrapper vs the actual test binary). Let me find the actual test binary process. Actually
pgrep -f "integration/multikueue"matched thego testwrapper. SIGQUIT to go test might be forwarded or might kill it. The process may have been killed. Let me check.Assistant
The actual test binary is pid 170579. Let me send SIGQUIT to it for a stack dump:
Assistant
The integration test environment is unreliable here (cluster creation hangs — only 1 of 3 apiservers starts in 6+ min, an environment/infra issue unrelated to my code; output is fully buffered). The unit tests thoroughly validate the fix. Let me clean up remaining processes:
Assistant
Cleaned up. Let me do a final confirmation run of the package unit tests and review the complete diff:
Assistant
Let me do a final review of the complete diff:
Assistant
The diff is clean and complete. Let me run the broader controller package tests once more to be safe that nothing regressed:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.