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

podman-inspect segfault on infra-container #3500

Closed
vrothberg opened this issue Jul 4, 2019 · 2 comments · Fixed by #3522
Closed

podman-inspect segfault on infra-container #3500

vrothberg opened this issue Jul 4, 2019 · 2 comments · Fixed by #3522
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@vrothberg
Copy link
Member

vrothberg commented Jul 4, 2019

Running podman-inspect on a Pods infra-container has some issues (see below).

podman inspect with useless output

[libpod (master)]$ ./bin/podman inspect a67b14bc75de
[
    null
]

podman inspect --type=container with segfault

[libpod (master)]$ ./bin/podman inspect --type=container a67b14bc75de
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x2f3 pc=0x1339508]

goroutine 1 [running]:
github.com/containers/libpod/cmd/podman/shared.GetCtrInspectInfo(0xc000529c00, 0xc0000fd680, 0x0, 0xc00027e7e0, 0x0, 0x0)
        cmd/podman/shared/container_inspect.go:132 +0x5d8
main.iterateInput(0x1b9c840, 0xc0000d6018, 0x18cc900, 0xc000445b60, 0x1, 0x2, 0xc000023210, 0x7ffcfd7ada83, 0x9, 0x18d1e36, ...)
        cmd/podman/inspect.go:161 +0x5c0
main.inspectCmd(0x2bf0d00, 0x0, 0x0)
        cmd/podman/inspect.go:118 +0x347
main.glob..func8(0x2b84460, 0xc000445b60, 0x1, 0x2, 0x0, 0x0)
        cmd/podman/inspect.go:37 +0x86
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).execute(0x2b84460, 0xc0000de060, 0x2, 0x2, 0x2b84460, 0xc0000de060)
        vendor/github.com/spf13/cobra/command.go:826 +0x465
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2b8df60, 0xc0000c6cf0, 0x7ffcfd7ada67, 0xc)
        vendor/github.com/spf13/cobra/command.go:914 +0x2fc
github.com/containers/libpod/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        vendor/github.com/spf13/cobra/command.go:864
main.main()
        cmd/podman/main.go:146 +0x88
@mheon
Copy link
Member

mheon commented Jul 4, 2019

It's assuming the create artifact is there.

Unfortunately that is not a safe assumption.

@mheon
Copy link
Member

mheon commented Jul 4, 2019

Alright, I'm going to self-assign this.

It may be possible to completely eliminate the create artifact. It looks like most of what we use it for is stored in libpod's ContainerConfig and the OCI spec already (though not in a format we can directly use - we'd need to convert it). The few others, we can probably stick in spec annotations for...

@mheon mheon self-assigned this Jul 4, 2019
mheon added a commit to mheon/libpod that referenced this issue Jul 17, 2019
When we first began writing Podman, we ran into a major issue
when implementing Inspect. Libpod deliberately does not tie its
internal data structures to Docker, and stores most information
about containers encoded within the OCI spec. However, Podman
must present a CLI compatible with Docker, which means it must
expose all the information in 'docker inspect' - most of which is
not contained in the OCI spec or libpod's Config struct.

Our solution at the time was the create artifact. We JSON'd the
complete CreateConfig (a parsed form of the CLI arguments to
'podman run') and stored it with the container, restoring it when
we needed to run commands that required the extra info.

Over the past month, I've been looking more at Inspect, and
refactored large portions of it into Libpod - generating them
from what we know about the OCI config and libpod's (now much
expanded, versus previously) container configuration. This path
comes close to completing the process, moving the last part of
inspect into libpod and removing the need for the create
artifact.

This improves libpod's compatability with non-Podman containers.
We no longer require an arbitrarily-formatted JSON blob to be
present to run inspect.

Fixes: containers#3500

Signed-off-by: Matthew Heon <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants