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

[apiv2] fails with 'runtime error: invalid memory address or nil pointer dereference' #6490

Closed
jgallucci32 opened this issue Jun 4, 2020 · 5 comments · Fixed by #6491
Closed
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@jgallucci32
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Podman API returns an error when querying information for certain docker image

Steps to reproduce the issue:

  1. Start Podman service in separate session
podman system service
  1. Pull image
podman pull docker.io/rancher/rke-tools:v0.1.56
  1. Use cURL to get information about image using API
curl --unix-socket /run/podman/podman.sock http://d/v1.24/images/rancher/rke-tools:v0.1.56/json

Describe the results you received:
Results in the following error

{"cause":"runtime error: invalid memory address or nil pointer dereference","message":"runtime error: invalid memory address or nil pointer dereference","response":500}

Describe the results you expected:
Checking a different image such as docker.io/library/hello-world produces the expected results

# curl --unix-socket /run/podman/podman.sock http://d/v1.24/images/library/hello-world/json
{"Id":"sha256:bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b","RepoTags":["docker.io/library/hello-world:latest"],"RepoDigests":["docker.io/library/hello-world@sha256:6a65f928fb91fcfbc963f7aa6d57c8eeb426ad9a20c7ee045538ef34847f44f1","docker.io/library/hello-world@sha256:90659bf80b44ce6be8234e6ff90a1ac34acbeb826903b02cfa0da11c82cbc042"],"Parent":"","Comment":"","Created":"2020-01-03T01:21:37.263809283Z","Container":"71237a2659e6419aee44fc0b51ffbd12859d1a50ba202e02c2586ed999def583","ContainerConfig":{"Hostname":"71237a2659e6","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"/hello\"]"],"ArgsEscaped":true,"Image":"sha256:eb850c6a1aedb3d5c62c3a484ff01b6b4aade130b950e3bf3e9c016f17f70c34","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":{}},"DockerVersion":"","Author":"","Config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/hello"],"Image":"","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null},"Architecture":"","Os":"","Size":20021,"VirtualSize":20021,"GraphDriver":{"Data":null,"Name":""},"RootFS":{"Type":""},"Metadata":{"LastTagTime":"0001-01-01T00:00:00Z"}}

Additional information you deem important (e.g. issue happens only occasionally):

It works with other rancher images such as rancher/rancher-agent:v2.4.3

Output of podman version:

Version:            1.9.3
RemoteAPI Version:  1
Go Version:         go1.13.6
OS/Arch:            linux/amd64

Output of podman info --debug:

debug:
  compiler: gc
  gitCommit: ""
  goVersion: go1.13.6
  podmanVersion: 1.9.3
host:
  arch: amd64
  buildahVersion: 1.14.9
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.17-1.el7.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.17, commit: e8e6160c8f8fb13ad100b53f3f25401e259b83c1'
  cpus: 4
  distribution:
    distribution: '"rhel"'
    version: "7.8"
  eventLogger: file
  hostname: hostname.local
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 3.10.0-1127.8.2.el7.x86_64
  memFree: 14304464896
  memTotal: 15599575040
  ociRuntime:
    name: runc
    package: runc-1.0.0-15.2.el7.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc10
      commit: 50d5773810ff80bea305931897920daa58a6a769
      spec: 1.0.1-dev
  os: linux
  rootless: false
  slirp4netns:
    executable: ""
    package: ""
    version: ""
  swapFree: 0
  swapTotal: 0
  uptime: 43m 12.52s
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - docker.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 3
  runRoot: /var/run/containers/storage
  volumePath: /var/lib/containers/storage/volumes

Package info (e.g. output of rpm -q podman or apt list podman):

podman-1.9.3-2.1.el7.x86_64

Additional environment details (AWS, VirtualBox, physical, etc.):
RHEL 7.8 Virtual Machine (KVM)

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 4, 2020
@vrothberg vrothberg self-assigned this Jun 4, 2020
@vrothberg
Copy link
Member

Thanks for opening the issue! I can reproduce the issue and will take a look. In case this issue is blocking you, you could use the libpod endpoint (i.e., ../libpod/images/rancher/....) which is working (on master).

vrothberg added a commit to vrothberg/libpod that referenced this issue Jun 4, 2020
Fix a bug when parsing the `ExposedPorts` of the image that lead to
panics when the field was set.  The OCI image spec allows three valid
formats: `tcp/port`, `udp/port` and `port`

Fixes: containers#6490
Reported-by: @jgallucci32
Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg
Copy link
Member

I opened #6491 to fix the issue. There was a bug in the port-parsing logic.

@jgallucci32
Copy link
Contributor Author

@vrothberg Thanks for addressing this so quicky!

@jgallucci32
Copy link
Contributor Author

@vrothberg I just tested this with Fedora Rawhide and have verified this issue has been resolved with the latest build

Version:      2.0.0-dev
API Version:  1
Go Version:   go1.14.3
Git Commit:   7e181c6bfe6b033e2ae53ce4f63b086e8cf5ea38
Built:        Thu Jun  4 17:00:00 2020
OS/Arch:      linux/amd64

Here is the correct output

{
  "Id": "sha256:8c8e0533fa439319ae0ada18d3a7380d33f14f313ea5dd750ab68a1fde65d909",
  "RepoTags": [
    "docker.io/rancher/rke-tools:v0.1.56"
  ],
  "RepoDigests": [
    "docker.io/rancher/rke-tools@sha256:167abae626d0ef9547170ba73183ef1f9b3548e6d61d590b8dfe5148f32ef0bf",
    "docker.io/rancher/rke-tools@sha256:b24b8f1009ac4784c9e274582bcc56dd5a54af8483a7661a57d8b8df857fdfdb"
  ],
  "Parent": "",
  "Comment": "",
  "Created": "2020-03-27T20:32:08.770543422Z",
  "Container": "c7553e5c20356768630afbdf513ca711a61a2d757353d7e80ef68a9835bd0abd",
  "ContainerConfig": {
    "Hostname": "c7553e5c2035",
    "Domainname": "",
    "User": "",
    "AttachStdin": false,
    "AttachStdout": false,
    "AttachStderr": false,
    "ExposedPorts": {
      "80/tcp": {}
    },
    "Tty": false,
    "OpenStdin": false,
    "StdinOnce": false,
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
      "NGINX_VERSION=1.16.0",
      "NJS_VERSION=0.3.1",
      "PKG_RELEASE=1",
      "DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.12.3.tgz",
      "DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.12.3/docker-v1.12.3_arm64.tgz",
      "DOCKER_URL=DOCKER_URL_amd64",
      "ETCD_URL_amd64=https://github.com/coreos/etcd/releases/download/v3.3.10/etcd-v3.3.10-linux-amd64.tar.gz",
      "ETCD_URL_arm64=https://github.com/etcd-io/etcd/releases/download/v3.3.10/etcd-v3.3.10-linux-arm64.tar.gz",
      "ETCD_URL=ETCD_URL_amd64"
    ],
    "Cmd": [
      "/bin/sh",
      "-c",
      "#(nop) ",
      "LABEL org.label-schema.vcs-url=https://github.com/rancher/rke-tools.git"
    ],
    "ArgsEscaped": true,
    "Image": "sha256:e2ca234664fa4fcd2fb81838b317dd0b5ddcfc24dec54fb0151e1433697e9d09",
    "Volumes": {
      "/opt/rke-tools": {}
    },
    "WorkingDir": "",
    "Entrypoint": null,
    "OnBuild": null,
    "Labels": {
      "maintainer": "Rancher Labs <[email protected]>",
      "org.label-schema.build-date": "2020-03-27T20:31:53Z",
      "org.label-schema.schema-version": "1.0",
      "org.label-schema.vcs-ref": "4c902f2def3830b6515029a127844fb8905a417b",
      "org.label-schema.vcs-url": "https://github.com/rancher/rke-tools.git"
    },
    "StopSignal": "SIGTERM"
  },
  "DockerVersion": "",
  "Author": "",
  "Config": {
    "Hostname": "",
    "Domainname": "",
    "User": "",
    "AttachStdin": false,
    "AttachStdout": false,
    "AttachStderr": false,
    "ExposedPorts": {
      "80/tcp": {}
    },
    "Tty": false,
    "OpenStdin": false,
    "StdinOnce": false,
    "Env": [
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
      "NGINX_VERSION=1.16.0",
      "NJS_VERSION=0.3.1",
      "PKG_RELEASE=1",
      "DOCKER_URL_amd64=https://get.docker.com/builds/Linux/x86_64/docker-1.12.3.tgz",
      "DOCKER_URL_arm64=https://github.com/rancher/docker/releases/download/v1.12.3/docker-v1.12.3_arm64.tgz",
      "DOCKER_URL=DOCKER_URL_amd64",
      "ETCD_URL_amd64=https://github.com/coreos/etcd/releases/download/v3.3.10/etcd-v3.3.10-linux-amd64.tar.gz",
      "ETCD_URL_arm64=https://github.com/etcd-io/etcd/releases/download/v3.3.10/etcd-v3.3.10-linux-arm64.tar.gz",
      "ETCD_URL=ETCD_URL_amd64"
    ],
    "Cmd": [
      "/bin/bash"
    ],
    "Image": "",
    "Volumes": null,
    "WorkingDir": "",
    "Entrypoint": null,
    "OnBuild": null,
    "Labels": {
      "maintainer": "Rancher Labs <[email protected]>",
      "org.label-schema.build-date": "2020-03-27T20:31:53Z",
      "org.label-schema.schema-version": "1.0",
      "org.label-schema.vcs-ref": "4c902f2def3830b6515029a127844fb8905a417b",
      "org.label-schema.vcs-url": "https://github.com/rancher/rke-tools.git"
    }
  },
  "Architecture": "",
  "Os": "",
  "Size": 135190082,
  "VirtualSize": 135190082,
  "GraphDriver": {
    "Data": null,
    "Name": ""
  },
  "RootFS": {
    "Type": ""
  },
  "Metadata": {
    "LastTagTime": "0001-01-01T00:00:00Z"
  }
}

@vrothberg
Copy link
Member

Wonderful, thanks for double checking!

@jgallucci32 jgallucci32 changed the title podman-api fails with 'runtime error: invalid memory address or nil pointer dereference' [apiv2] fails with 'runtime error: invalid memory address or nil pointer dereference' Jun 8, 2020
@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 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. 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.

3 participants