Repository navigation
Conversation
…ds a refused update once - Shutdown waits for a poll in flight to return and hands its tasks to the executor, which still takes them. Before, the executor was shut down under the poll, its tasks were refused, and each waited out its response timeout on the server. A poll that is terminating the JVM (fatal auth) is not waited for: System.exit waits for the shutdown hooks. - With taskUpdateV2, a task finishing after shutdown began is sent with update, which hands nothing back; a task an update handed back as shutdown began, which the ended poll loop no longer takes, runs before shutdown returns. Before, both waited out their response timeout. - A 4xx update other than 408 or 429 is not retried: the same request is refused again, and each retry held a worker thread for 2 s.
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.
Three
TaskRunnerbugs, each shown by a test in the newTaskRunnerShutdownTestthat fails onmainand passes here. Nothing changes for a runner that is not shutting down, apart from the 4xx retries.Shutdown drops the tasks of a poll in flight
shutdownshut the executor down while a poll was still on its way. The tasks the poll brought back were refused (Task rejected by executor (likely shutting down); dropping task). The server had leased them to this worker, so each waited out its response timeout before anyone else could take it.Now shutdown waits, up to its timeout, for a poll in flight to return and its tasks to reach the executor. It does not wait through the polling interval: only the poll itself counts. A poll that is terminating the JVM on a fatal auth failure is not waited for, because
System.exitwaits for the shutdown hooks that callshutdown.Tests:
theTasksOfAPollInFlightWhenShutdownBeginsStillRunfails onmain.shutdownDoesNotWaitForAPollLoopThatIsTerminatingTheJvmguards the fatal-auth case (it fails without theexitingflag).With
taskUpdateV2, tasks handed back at shutdown wait out their timeoutupdate-v2 hands back the worker's next task, already leased to it, and the poll loop picks it up from an in-memory queue. At shutdown the loop has ended, so:
updateTask, which hands nothing back.shutdownreturns, once the executor's tasks are done.Tests:
withUpdateV2ATaskFinishingDuringShutdownTakesNoNextTaskandwithUpdateV2ATaskHandedBackAsShutdownBeginsStillRunsfail onmain.A refused update is retried
retryOperationretried every failure 3 times, 2 s apart. A 4xx (a task the server no longer has, a stale or duplicate update) is refused again on every retry, and each retry holds a worker thread. Now a 4xx other than 408 and 429 is not retried. 5xx, 408, 429 and network errors are retried as before. An expired token is refreshed byTokenRefreshInterceptorbefore the error reachesTaskRunner, so a 401 here is final too.Tests:
aRefusedUpdateIsSentOncefails onmain.aThrottledUpdateIsRetriedguards the retry that stays.Testing
TaskRunnerShutdownTest: 4 of 6 fail onmain, all 6 pass here../gradlew spotlessCheck :conductor-client:test :conductor-client-spring:test :conductor-client-spring-boot4:test: 1001, 2 and 29 tests, all pass.