You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): stop polling instances after deregistration - #6005
The status and info monitors retained every instance ID they had checked. After an instance deregistered, each timer kept calling its updater and looking it up in the repository. In a deployment where instances are replaced regularly, the work per tick grew with the number of past instances.
Remove the ID from both schedules on deregistration. An update already in flight can refresh the completion time only while the ID is still tracked. A subsequent registration can start monitoring the same ID again.
Each trigger has a regression test that holds an update open, deregisters the instance, and lets the update finish. It verifies that another instance continues to be polled, that the removed ID stays quiet, and that polling resumes when it returns.
Thanks for this, the unbounded growth of the tracked IDs is a real problem. One side effect I want to flag after reading the diff.
checkNow sets lastChecked to Instant.MAX, and only markAsCheckedIfTracked (called from doFinally) lowers it again. Before this change a check that never completed was simply retried on the next tick, because the entry was only written when a check finished. Now a check that never completes leaves the entry at Instant.MAX, so that instance is never polled again until it is deregistered and registered again.
I confirmed the mechanics with a throwaway test on master (5b6662b6): IntervalCheck with a check function returning Mono.never(), interval 10 ms, minRetention zero, 500 ms of runtime.
via checkNow: the check function is called exactly once.
via markAsChecked (previous behavior): it is called more than 5 times.
What I could not verify is whether a real check can fail to complete. In StatusUpdater.doUpdateStatus only the HTTP call has a timeout (interval - 1s). repository.computeIfPresent has none, and neither does InfoUpdater. So a stalled event store write, for example with a clustered store, would never be bounded. I have no reproduction of that, so this is a robustness concern and not a confirmed bug.
If you agree, a small follow-up could add an outer .timeout(...) in StatusUpdateTrigger.updateStatus and InfoUpdateTrigger.updateInfo, so doFinally always runs. I am happy to open that PR. Let me know if you would rather handle it differently.
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
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.
The status and info monitors retained every instance ID they had checked. After an instance deregistered, each timer kept calling its updater and looking it up in the repository. In a deployment where instances are replaced regularly, the work per tick grew with the number of past instances.
Remove the ID from both schedules on deregistration. An update already in flight can refresh the completion time only while the ID is still tracked. A subsequent registration can start monitoring the same ID again.
Each trigger has a regression test that holds an update open, deregisters the instance, and lets the update finish. It verifies that another instance continues to be polled, that the removed ID stays quiet, and that polling resumes when it returns.