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
I have a resource whose status includes a list of conditions. This is serialised as an array. In my reconcile method I update the conditions list like so:
shouldPatchStatus = false
for each condition type {
var previous = get previous condition from list
var desired = compute new condition state
if (previous != desired) {
if (previous == null) {
add desired to list
} else if (desired == null) {
remove previous from list
} else {
apply state of desired to previous (update in place)
}
shouldPatchStatus = true
}
}
return shouldPatchStatus ? UpdateControl.patchStatus : UpdateControl.noUpdate
In practice I find that I get duplicate entries appearing in the conditions list, usually differing only by lastTransitionTime with a delta of a few ms.
When I look at logs, I see the two instances of the condition apparently added by two reconciliation cycles, ms apart. One follows the other (no overlap), but they can take place on different threads. They both seem to operate on the same resource version. The logs look something like:
JOSDK does not perform multiple concurrent reconciles on the same resource, so if this is true, I do not see how there could be concurrent updates to the same list. The logs appear sequential also - suggesting that the reconciliations are not concurrent.
With SSA, array updates are atomic, so in the event of a race, I might either see a conflict, or "last writer wins", but inexplicably I see two elements for a given type persisted in the status.
Can you suggest why this may be happening and how I might guard against it?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
JOSDK v4.9.7
I have a resource whose status includes a list of conditions. This is serialised as an array. In my reconcile method I update the conditions list like so:
In practice I find that I get duplicate entries appearing in the conditions list, usually differing only by
lastTransitionTimewith a delta of a few ms.When I look at logs, I see the two instances of the condition apparently added by two reconciliation cycles, ms apart. One follows the other (no overlap), but they can take place on different threads. They both seem to operate on the same resource version. The logs look something like:
As I undertand it:
Can you suggest why this may be happening and how I might guard against it?
Beta Was this translation helpful? Give feedback.
All reactions