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 socket API top returns Titles as single string instead of array of strings #17524

Closed
BouncingBit opened this issue Feb 16, 2023 · 2 comments · Fixed by #18136
Closed
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. HTTP API Bug is in RESTful API 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

@BouncingBit
Copy link

Issue Description

I'm using RHEL 9.1 and podman 4.2.0 with crun 1.5.
I was trying to get a container functional with is based on newrelic infrastructure agent.
The agent was tested with docker initially, but I wanted to test it using podman.

As the container requires the docker socket to be mounted into the container I started the podman.socket.
However I noticed that there were errors regarding querying container processes using the docker top from within the container.
That is the container queries the REST API of the podman.socket for processes.

Curious on what why this is failing I investigated the podman REST endpoint and found that the GET request documented here:
https://docs.podman.io/en/latest/_static/api.html#tag/containers-(compat)/operation/ContainerList

behaves different for the "Titles" field in the response.
This should be an array of strings, however using:
curl --silent -XGET --unix-socket $XDG_RUNTIME_DIR/podman/podman.sock -H 'Content-Type: application/json' http://localhost/containers/321be6b5b7264ee5dfe651fe78355c3ce450c3167f245136bcf5cb66ae9107fe/top

delivers ONE string for "Titles":
{... ,"Titles":["PID USER TIME COMMAND"]}

However this is ONE string and not an array as stated in the documentation.

Steps to reproduce the issue

Steps to reproduce the issue

  1. systemctl --user start podman.socket
  2. start at least one container and note the id of that container
  3. curl --silent -XGET --unix-socket $XDG_RUNTIME_DIR/podman/podman.sock -H 'Content-Type: application/json' http://localhost/containers/<CONTAINER_ID_REPLACE_ME>/top

Describe the results you received

The "Titles" from the response is:
{... ,"Titles":["PID USER TIME COMMAND"]}

Describe the results you expected

The "Titles" field should be:
"Titles":["PID", "USER", "TIME", "COMMAND"]}

podman info output

host:
  arch: amd64
  buildahVersion: 1.27.3
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.4-1.el9.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.4, commit: 56561007b6a59ea175ee9a67384639721499e160'
  cpuUtilization:
    idlePercent: 99.66
    systemPercent: 0.08
    userPercent: 0.26
  cpus: 8
  distribution:
    distribution: '"rhel"'
    version: "9.1"
  eventLogger: journald
  hostname: noname
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 2019
      size: 1
    - container_id: 1
      host_id: 1476256
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 2019
      size: 1
    - container_id: 1
      host_id: 1476256
      size: 65536
  kernel: 5.14.0-162.12.1.el9_1.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 132173471744
  memTotal: 134531371008
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun-1.5-1.el9.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.5
      commit: 54ebb8ca8bf7e6ddae2eb919f5b82d1d96863dea
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/2019/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_NET_RAW,CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-2.el9_0.x86_64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.4.0
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.2
  swapFree: 4294963200
  swapTotal: 4294963200
  uptime: 73h 7m 7.00s (Approximately 3.04 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.access.redhat.com
  - registry.redhat.io
  - docker.io
store:
  configFile: /home/noname/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/noname/.local/share/containers/storage
  graphRootAllocated: 33246150656
  graphRootUsed: 2582650880
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 4
  runRoot: /run/user/2019/containers
  volumePath: /home/noname/.local/share/containers/storage/volumes
version:
  APIVersion: 4.2.0
  Built: 1670843566
  BuiltTime: Mon Dec 12 12:12:46 2022
  GitCommit: ""
  GoVersion: go1.18.4
  Os: linux
  OsArch: linux/amd64
  Version: 4.2.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

No

Additional environment details

Additional environment details

Additional information

Additional information like issue happens only occasionally or issue happens with a particular architecture or on a particular setting

@BouncingBit BouncingBit added the kind/bug Categorizes issue or PR as related to a bug. label Feb 16, 2023
@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@alvarogonzalez-packlink

Yep. Also, software relying on this compatibility is failing. In this case, the New Relic Infrastructure Agent:

https://forum.newrelic.com/s/hubtopic/aAX8W0000008eVsWAI/infrastructure-docker-agent-running-with-podmancrun

I'm not the poster to the New Relic Support Forum, but I'm having the same problem.

@mheon mheon added HTTP API Bug is in RESTful API Good First Issue This issue would be a good issue for a first time contributor to undertake. labels Apr 10, 2023
rhatdan added a commit to rhatdan/podman that referenced this issue Apr 13, 2023
Podman is attempting to split the headers returned by the ps
command into a list of headers. Problem is that some headers
are multi-word, and headers are not guaranteed to be split via
a tab. This PR splits the headers bases on white space, and for
the select group of CAPS headers which are multi-word, combines
them back together.

Fixes: containers#17524

Signed-off-by: Daniel J Walsh <[email protected]>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/podman that referenced this issue Apr 13, 2023
Podman is attempting to split the headers returned by the ps
command into a list of headers. Problem is that some headers
are multi-word, and headers are not guaranteed to be split via
a tab. This PR splits the headers bases on white space, and for
the select group of CAPS headers which are multi-word, combines
them back together.

Fixes: containers#17524

Signed-off-by: Daniel J Walsh <[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 Aug 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. HTTP API Bug is in RESTful API 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.

4 participants