Skip to content

Context cancellation not properly handled across command functions - SIGINT doesn't trigger graceful shutdown #563

@Priyanka-Chatterjee-2000

Description

Describe the bug
The Tailpipe CLI commands set up context cancellation handlers to respond to SIGINT (Ctrl+C), but the underlying functions don't properly respect context cancellation. This results in:

  • Defer blocks not executing when users try to cancel operations
  • Unresponsive commands that ignore SIGINT signals
    Example: Call Chain Where Context is Lost
┌─ runSourceShowCmd()                        [✅ Creates context + cancel handler]
│   │
│   └─ display.GetSourceResource(ctx, name)  [✅ Context passed correctly]
│       │
│       └─ pm.Describe(ctx, pluginName)      [✅ Context passed correctly]  
│           │
│           └─ pluginClient.Describe(req)    [❌ BREAKS HERE - No context!]
│               │
│               └─ [gRPC network call runs regardless of cancellation]

When SIGINT is sent, the cancel handler triggers, but the gRPC call at the bottom of the chain doesn't receive or use the context, so it continues running and blocks the entire call stack from returning.
Result: The defer block in runSourceShowCmd() never executes because the function never returns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions