Skip to content

client: skip runc options unmarshal for non-runc runtime types#12986

Closed
fidencio wants to merge 1 commit into
containerd:mainfrom
fidencio:topic/fix-runc-options-type-mismatch-for-non-runc-runtimes
Closed

client: skip runc options unmarshal for non-runc runtime types#12986
fidencio wants to merge 1 commit into
containerd:mainfrom
fidencio:topic/fix-runc-options-type-mismatch-for-non-runc-runtimes

Conversation

@fidencio

@fidencio fidencio commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

getRuncOptions() tries to copy the container's stored runtimeOptions into a fresh *runc.v1.Options before returning it to callers like WithTaskAPIEndpoint. This works for runc containers but fails when the container's runtime options are of a different type, e.g. runtimeoptions.v1.Options used by Kata Containers and other non-runc runtimes. typeurl.UnmarshalTo() rejects the cross-type unmarshal with:

  can't unmarshal type "runtimeoptions.v1.Options" to output
  "containerd.runc.v1.Options"

The error then propagates as "failed to create containerd task: failed to get runtime v2 options: ..." and breaks container start for every test that runs inside a Kata sandbox when the shim sandboxer is active.

Let's ensure we check typeurl.Is() efore attempting the unmarshal. If the stored runtimeOptions are not runc.v1.Options we simply return an empty *options.Options so that callers can still populate task-level fields (TaskApiAddress, TaskApiVersion, etc.) without error.

@fidencio

fidencio commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

cc @mxpv @lifupan

@mxpv

mxpv commented Mar 6, 2026

Copy link
Copy Markdown
Member

My attempt to solve this at a fundamental level: #12786

@fidencio

fidencio commented Mar 6, 2026

Copy link
Copy Markdown
Contributor Author

My attempt to solve this at a fundamental level: #12786

Even better! I'm closing this one, thanks @mxpv!

@fidencio fidencio closed this Mar 6, 2026
@github-project-automation github-project-automation Bot moved this from Needs Triage to Done in Pull Request Review Mar 6, 2026
@fidencio fidencio reopened this May 7, 2026
getRuncOptions() tries to copy the container's stored runtimeOptions
into a fresh *runc.v1.Options before returning it to callers like
WithTaskAPIEndpoint. This works for runc containers but fails when the
container's runtime options are of a different type, e.g.
runtimeoptions.v1.Options used by Kata Containers and other non-runc
runtimes. typeurl.UnmarshalTo() rejects the cross-type unmarshal with:
```
  can't unmarshal type "runtimeoptions.v1.Options" to output
  "containerd.runc.v1.Options"
```

The error then propagates as "failed to create containerd task: failed
to get runtime v2 options: ..." and breaks container start for every
test that runs inside a Kata sandbox when the shim sandboxer is active.

Let's ensure we check typeurl.Is() efore attempting the unmarshal. If
the stored runtimeOptions are not runc.v1.Options we simply return an
empty *options.Options so that callers can still populate task-level
fields (TaskApiAddress, TaskApiVersion, etc.) without error.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
@fidencio fidencio force-pushed the topic/fix-runc-options-type-mismatch-for-non-runc-runtimes branch from 25e7c62 to 553b530 Compare May 7, 2026 21:11
@fidencio fidencio closed this May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants