Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only set pidAttrs when child.Process is not nil #363

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

msarahan
Copy link

@msarahan msarahan commented Oct 9, 2024

I'm observing a crash with the following example program:

otel-cli exec 'echo moo'

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x97819b]

goroutine 1 [running]:
github.com/equinix-labs/otel-cli/otelcli.doExec(0xc000200f00?, {0xc0002b7220, 0x1, 0xa})
        /home/atobey/src/otel-cli/otelcli/exec.go:149 +0x109b
github.com/spf13/cobra.(*Command).execute(0xc0002a8900, {0xc0002b70e0, 0xa, 0xa})
        /home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xaa3
github.com/spf13/cobra.(*Command).ExecuteC(0xc000005800)
        /home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /home/atobey/go/pkg/mod/github.com/spf13/[email protected]/command.go:1032
github.com/equinix-labs/otel-cli/otelcli.Execute({0xc00003c4b0, 0x43})
        /home/atobey/src/otel-cli/otelcli/root.go:89 +0x188
main.main()
        /home/atobey/src/otel-cli/main.go:17 +0x45

This is mean to create a subprocess that sets TRACEPARENT such that the subprocess propagates the trace and the subprocess appears as a child.

FWIW, this works ok:

otel-cli exec echo moo

I built the project from source with a debugger, and found that with these arguments, the child.Process object is nil. I don't know if this is a bug, or if I'm just doing things wrong. Feel free to close this PR if I'm just doing things wrong, or if my approach will have unanticipated consequences.

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