Skip to content

fix: handle null Docker runtimes - #2109

Open
git-jxj wants to merge 1 commit into
NVIDIA:mainfrom
git-jxj:git-jxj/fix-docker-null-runtimes
Open

git-jxj wants to merge 1 commit into
NVIDIA:mainfrom
git-jxj:git-jxj/fix-docker-null-runtimes

Conversation

@git-jxj

@git-jxj git-jxj commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Description

nvidia-ctk runtime configure --runtime=docker --config=daemon.json panics when the file contains {"runtimes":null}. JSON decoding stores a nil interface for runtimes, but the Docker configuration methods assert any present entry to a map.

Treat a null runtimes entry like an absent entry when adding, removing, or looking up a runtime. The new regression loads a file containing null runtimes, exercises all three operations, and verifies that unrelated settings survive saving the configuration.

Checklist

  • No secrets, sensitive information, or unrelated changes
  • Unit tests passing (make test) — the same four packages and nine subtests fail on unchanged main; see below
  • Lint checks passing (make lint)
  • Test cases are added for new code paths
  • Commits are signed-off and cryptographically signed

Testing

  • Before the fix, each new add/remove/get case panics independently. A freshly built baseline nvidia-ctk runtime configure also exits 2 for a temporary file containing {"runtimes":null,"log-driver":"json-file"}.
  • After the fix, the CLI exits successfully, writes the NVIDIA runtime, preserves log-driver, and produces the same configuration on a second run. This used an isolated temporary file; it did not reconfigure or restart Docker.
  • make build, make fmt, and make lint completed. Lint reported 0 issues.
  • go test -race ./pkg/config/... ./cmd/nvidia-ctk/runtime/... -count=1 passed.
  • make test was run on this change and an unchanged checkout of main (84e2c2c182bfa0b2edab4fdca27e5197faba0ca7). Both fail the same nine subtests in cmd/nvidia-ctk-installer, cmd/nvidia-ctk-installer/toolkit, internal/modifier, and pkg/nvcdi, involving driver-library discovery in test fixtures and CSV hook expectations. All other packages pass. No GPU container E2E result is claimed for this configuration fix.

A JSON null runtimes entry decodes to a nil interface. Adding, removing,
or looking up a runtime currently asserts that value to a map and panics.
Treat a null runtimes entry like an absent entry before the assertion.

Cover all three operations using a configuration loaded from a file and
verify unrelated settings survive saving the updated configuration.

Signed-off-by: xinjun.jiang <xinjun.jiang@daocloud.io>
@copy-pr-bot

copy-pr-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant