Skip to content

containerd 2.2 cannot parse the bootstrap response from a 2.3 runc shim #13763

Closed

Description

@vvoland

A containerd 2.2 runtime-v2 manager cannot start containerd-shim-runc-v2 from containerd 2.3.

The 2.3 shim accepts the legacy CLI, environment, and stdin invocation used by containerd 2.2 and starts the shim process.
However, it unconditionally writes the new protobuf-encoded BootstrapResult to stdout.

Containerd 2.2 only understands a JSON BootstrapParams response or a legacy plain socket address.
When JSON decoding fails, it treats the complete protobuf payload as the socket address and eventually reports:

failed to create TTRPC connection: unsupported protocol: \b\x03\x12Yunix

This was observed in moby/moby#52898 - Moby's embedded containerd used containerd 2.2 vendored code while containerd-shim-runc-v2 2.3 was resolved from the host's containerd 2.3 binaries.

The same mismatch can occur during a partial package upgrade where the containerd daemon and shim are upgraded separately.

The bootstrap protocol change states that pkg/shim falls back to the legacy CLI, environment, and stdin interface for compatibility:

Steps to reproduce the issue

  1. Install or build a containerd 2.2 daemon.
  2. Put containerd-shim-runc-v2 from containerd 2.3 first on the daemon's PATH.
  3. Start containerd 2.2.
  4. Create and start a task using io.containerd.runc.v2.

For example, after pulling BusyBox:

$ sudo ctr run --rm busybox bootstrap-repro true

Describe the results you received and expected

The task fails while connecting to the newly started shim:


INFO connecting to shim 439f8fbaa130f0c8357fcc3c9c381096b9aeb4b317b51cc88ea2f723cf827c9b
   address="\b\x03\x12Yunix:///run/containerd/s/44fbea273a42ed5d0f75c735c58d6db5bd4d44d8de85d5f063cae3edb4f94093\x1a\x05ttrpc"
   namespace=moby protocol=ttrpc version=2

failed to create task for container: failed to start shim: start failed:
failed to create TTRPC connection: unsupported protocol: \b\x03\x12Yunix

The address bytes are a protobuf-encoded BootstrapResult:

08 03       version = 3
12 59 ...   address = "unix:///run/containerd/s/..."
1a 05 ...   protocol = "ttrpc"

In containerd 2.2, parseStartResponse attempts JSON decoding and then falls back to treating the response as a plain address. It therefore uses the complete protobuf payload as the address.

In containerd 2.3, the shim's legacy-input compatibility path reconstructs BootstrapParams from the deprecated CLI, environment, and stdin fields, but the result is still unconditionally serialized as protobuf.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions