Skip to content

cmd/compute-domain-daemon: non-converging CD status due to lost node updates#1049

Open
aditighag wants to merge 1 commit into
kubernetes-sigs:mainfrom
aditighag:pr/aditighag/cd-status-non-converging
Open

cmd/compute-domain-daemon: non-converging CD status due to lost node updates#1049
aditighag wants to merge 1 commit into
kubernetes-sigs:mainfrom
aditighag:pr/aditighag/cd-status-non-converging

Conversation

@aditighag
Copy link
Copy Markdown

When multiple compute-domain daemon pods update ComputeDomain status from their own view of the object, syncNodeInfoToCD rewrites the full status.nodes list and can drop a peer node entry. The CD status fails to converge.

Add a unit test that reproduces this lost-update behavior by simulating two daemon instances reading the same initial ComputeDomain object and then writing their node info sequentially.

Snippets from a real cluster deployment highlighting the bug -

Status:
  Nodes:
    Clique Id: 9f410827-489f-46fd-8203-51266ca08eb7.32766
    Index: 0
    Ip Address: 10.42.3.138
    Name: cluster1-mgx-00011
    Status: NotReady
    Clique Id: 9f410827-489f-46fd-8203-51266ca08eb7.32766
    Index: 1
    Ip Address: 10.42.1.100
    Name: cluster1-mgx-00017
    Status: NotReady
  Status: NotReady
Events: <none>

I0415 16:14:28.038085 1 cdstatus.go:276] Successfully inserted/updated node in CD (nodeinfo: &{cluster1-mgx-00011 10.42.3.138 9f410827-489f-46fd-8203-51266ca08eb7.32766 0 NotReady})
I0415 16:14:28.038098 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:28.044285 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:28.044300 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:28.053413 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:28.053424 1 cdstatus.go:354] IP set for clique did not change

I0415 16:14:30.033811 1 cdstatus.go:259] CD status does not contain node name 'cluster1-mgx-00011' yet, try to insert myself: &{cluster1-mgx-00011 9f410827-489f-46fd-8203-51266ca08eb7.32766 0 NotReady}
I0415 16:14:30.037427 1 round_trippers.go:632] "Response" verb="PUT" url="https://10.43.0.1:443/apis/resource.nvidia.com/v1beta1/namespaces/default/computedomains/imex-channel-injection/status" status="200 OK" milliseconds=3
I0415 16:14:30.037620 1 cdstatus.go:276] Successfully inserted/updated node in CD (nodeinfo: &{cluster1-mgx-00011 10.42.3.138 9f410827-489f-46fd-8203-51266ca08eb7.32766 0 NotReady})
I0415 16:14:30.037656 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:30.042979 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:30.042995 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:30.052870 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:30.052888 1 cdstatus.go:354] IP set for clique did not change

@k8s-ci-robot k8s-ci-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Apr 16, 2026
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 16, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: aditighag / name: Aditi Ghag (8489b57)

@k8s-ci-robot k8s-ci-robot added the needs-kind Indicates a PR lacks a `kind/foo` label and requires one. label Apr 16, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Welcome @aditighag!

It looks like this is your first PR to kubernetes-sigs/dra-driver-nvidia-gpu 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/dra-driver-nvidia-gpu has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 16, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @aditighag. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 16, 2026
Copy link
Copy Markdown
Contributor

@ArangoGutierrez ArangoGutierrez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repro is clean and the race is real. A few notes on the test shape before this lands.

1. noopMutationCache hides what a fix needs to do. Calling syncNodeInfoToCD directly with a no-op mutation cache exposes the writer race, but a fix that relies on the mutation cache (reading back the server's post-write object in onAddOrUpdatem.Get()) is indistinguishable from a fix that just adds retry-on-conflict in the writer — both pass. Consider a second test that drives onAddOrUpdate through the real NewIntegerResourceVersionMutationCache and asserts a stale inbound UPDATE does not overwrite fresher state.

2. N=2 scenario only. The repro has two writers. The production failure mode is N writers racing after an informer resync burst. A fix that serializes only two writers (local mutex, etc.) would pass this test and still break at scale. Suggest parameterising on N, or asserting "all N entries survive" as the invariant.

3. Test-only PR, CI implications. This is the first _test.go under cmd/compute-domain-daemon/. If that path is on the default go test / make test, merging leaves CI red. Either land the fix in the same PR, or gate the repro behind t.Skip("tracked in #<issue>") with a follow-up issue.

4. Design question for the fix (non-blocking here). Full-object UpdateStatus from a stale snapshot is racy by construction. Two idiomatic paths: retry.RetryOnConflict with a ResourceVersion precondition, or a targeted patch that mutates only this daemon's own .status.nodes[i] entry. The latter eliminates the class of bug rather than retrying around it. Worth calling out in the fix PR so reviewers can anchor on one model.

Requesting changes pending the fix + broader-N test.

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aditighag
Once this PR has been reviewed and has the lgtm label, please assign varunrsekar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@aditighag
Copy link
Copy Markdown
Author

aditighag commented Apr 20, 2026

  1. N=2 scenario only. The repro has two writers. The production failure mode is N writers racing after an informer resync burst. A fix that serializes only two writers (local mutex, etc.) would pass this test and still break at scale. Suggest parameterising on N, or asserting "all N entries survive" as the invariant.

Sure, I'll extend the test by parameterizing numofNodes.

  1. Test-only PR, CI implications. This is the first _test.go under cmd/compute-domain-daemon/. If that path is on the default go test / make test, merging leaves CI red. Either land the fix in the same PR, or gate the repro behind t.Skip("tracked in #") with a follow-up issue.

I can take a stab at the fix in a follow-up PR. Any objections to merging this PR that adds a unit test repro for the bug?

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Apr 20, 2026
@aditighag aditighag force-pushed the pr/aditighag/cd-status-non-converging branch from 4d86370 to 7cc7929 Compare April 20, 2026 19:49
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 20, 2026

Deploy Preview for dra-driver-nvidia-gpu ready!

Name Link
🔨 Latest commit 8489b57
🔍 Latest deploy log https://app.netlify.com/projects/dra-driver-nvidia-gpu/deploys/69e6847ec21f4d0008d51f0a
😎 Deploy Preview https://deploy-preview-1049--dra-driver-nvidia-gpu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 20, 2026
@aditighag
Copy link
Copy Markdown
Author

@ArangoGutierrez Addressed review comments in the latest push. PTAL!

…updates

When multiple compute-domain daemon pods update ComputeDomain status
from their own view of the object, syncNodeInfoToCD rewrites the
full status.nodes list and can drop a peer node entry. The CD status
fails to converge.

Add a unit test that reproduces this lost-update behavior by simulating
multiple daemon instances reading the same initial ComputeDomain object and
then writing their node info sequentially.

Snippets from a real cluster deployment highlighting the bug -

```
Status:
  Nodes:
    Clique Id: 9f410827-489f-46fd-8203-51266ca08eb7.32766
    Index: 0
    Ip Address: 10.42.3.138
    Name: cluster1-mgx-00011
    Status: NotReady
    Clique Id: 9f410827-489f-46fd-8203-51266ca08eb7.32766
    Index: 1
    Ip Address: 10.42.1.100
    Name: cluster1-mgx-00017
    Status: NotReady
  Status: NotReady
Events: <none>

I0415 16:14:28.038085 1 cdstatus.go:276] Successfully inserted/updated node in CD (nodeinfo: &{cluster1-mgx-00011 10.42.3.138 9f410827-489f-46fd-8203-51266ca08eb7.32766 0 NotReady})
I0415 16:14:28.038098 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:28.044285 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:28.044300 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:28.053413 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:28.053424 1 cdstatus.go:354] IP set for clique did not change

I0415 16:14:30.033811 1 cdstatus.go:259] CD status does not contain node name 'cluster1-mgx-00011' yet, try to insert myself: &{cluster1-mgx-00011 9f410827-489f-46fd-8203-51266ca08eb7.32766 0 NotReady}
I0415 16:14:30.037427 1 round_trippers.go:632] "Response" verb="PUT" url="https://10.43.0.1:443/apis/resource.nvidia.com/v1beta1/namespaces/default/computedomains/imex-channel-injection/status" status="200 OK" milliseconds=3
I0415 16:14:30.037620 1 cdstatus.go:276] Successfully inserted/updated node in CD (nodeinfo: &{cluster1-mgx-00011 10.42.3.138 9f410827-489f-46fd-8203-51266ca08eb7.32766 0 NotReady})
I0415 16:14:30.037656 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:30.042979 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:30.042995 1 cdstatus.go:339] numNodes: 2, nodes seen: 1
I0415 16:14:30.052870 1 cdstatus.go:239] syncNodeInfoToCD noop: pod IP unchanged (10.42.3.138)
I0415 16:14:30.052888 1 cdstatus.go:354] IP set for clique did not change

```

Signed-off-by: Aditi Ghag <aditi.ghag@lambdal.com>
@aditighag aditighag force-pushed the pr/aditighag/cd-status-non-converging branch from 7cc7929 to 8489b57 Compare April 20, 2026 19:54
@aditighag
Copy link
Copy Markdown
Author

@ArangoGutierrez Ping? :)

@dims
Copy link
Copy Markdown
Member

dims commented Apr 27, 2026

/ok-to-test
/release-note-none

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Apr 27, 2026
@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 27, 2026
@dims
Copy link
Copy Markdown
Member

dims commented Apr 27, 2026

/assign @shivamerla

@guptaNswati
Copy link
Copy Markdown
Contributor

test failure is a flake.

@aditighag
Copy link
Copy Markdown
Author

@dims / @guptaNswati

test failure is a flake.

Could you re-trigger the test? Thanks!

@dims
Copy link
Copy Markdown
Member

dims commented May 8, 2026

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

6 participants