Skip to content

containerd-shim-lcow-v2: Fix shimManager.Stop not correctly getting the context - #2920

Merged
Harsh Rawat (rawahars) merged 1 commit into
microsoft:mainfrom
micromaomao:lcow-v2-fix-stop
Sep 3, 2026
Merged

containerd-shim-lcow-v2: Fix shimManager.Stop not correctly getting the context#2920
Harsh Rawat (rawahars) merged 1 commit into
microsoft:mainfrom
micromaomao:lcow-v2-fix-stop

Conversation

@micromaomao

Copy link
Copy Markdown
Member

0f25a01 ("Replace OpenCensus with OpenTelemetry (#2828)") turned this

    ctx, span := oc.StartSpan(ctx, "delete")

into a

    ctx, span := ot.StartSpan(context.Background(), "delete")

because we later get a value from the context:

if opts, ok := ctx.Value(shim.OptsKey{}).(shim.Opts); ok {
	bundlePath = opts.BundlePath
}

if bundlePath == "" {
	return resp, fmt.Errorf("bundle path not found in context")
}

this change probably broke it

Assisted-by: GitHub-Copilot

…he context

0f25a01 ("Replace OpenCensus with OpenTelemetry (microsoft#2828)") turned this
    ctx, span := oc.StartSpan(ctx, "delete")
into a
    ctx, span := ot.StartSpan(context.Background(), "delete")

because we later get a value from the context:
    if opts, ok := ctx.Value(shim.OptsKey{}).(shim.Opts); ok {
    	bundlePath = opts.BundlePath
    }

    if bundlePath == "" {
    	return resp, fmt.Errorf("bundle path not found in context")
    }
this change probably broke it

Assisted-by: GitHub-Copilot
Signed-off-by: Tingmao Wang <tingmaowang@microsoft.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The context propagation fix is focused, regression-tested, and has no unresolved issues.

Pull request overview

Restores context propagation in shimManager.Stop, ensuring shim options remain available after tracing begins.

Changes:

  • Passes the caller context to ot.StartSpan.
  • Adds regression coverage for bundle-path preservation and stop status.
File summaries
File Description
cmd/containerd-shim-lcow-v2/manager.go Preserves the incoming context when starting the trace span.
cmd/containerd-shim-lcow-v2/manager_test.go Tests context propagation through Stop.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@rawahars
Harsh Rawat (rawahars) merged commit d94399a into microsoft:main Sep 3, 2026
20 checks passed
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.

3 participants