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

Docker compatible /containers/<id or name>/stop does not support negative timeouts #17542

Closed
matthewpi opened this issue Feb 16, 2023 · 1 comment · Fixed by #19425
Closed
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

@matthewpi
Copy link

Issue Description

The Docker compatible /containers/<id or name>/stop endpoint does not support using a negative timeout. Docker's spec for this endpoint states that you can "use '-1' to wait indefinitely." rather then having a set timeout after which the container will be killed. Podman's implementation of this endpoint utilizes a uint rather then an int, causing a error to be thrown when using negative values.

Steps to reproduce the issue

Steps to reproduce the issue

  1. Run a container
  2. Send stop request with a negative (indefinite) timeout value of -1 (if using the Docker Go SDK this will need to be -1 * time.Second)
  3. Notice the error

Describe the results you received

Request returns an error and the container continues to run.

failed to parse parameters for /v1.41/containers/<ID>/stop?t=-1: schema: error converting value for "t"

Describe the results you expected

Container is sent a stop signal and is not terminated immediately or after a default timeout.

podman info output

host:
  arch: amd64
  buildahVersion: 1.29.0-dev
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.5-3.fc38.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.5, commit: '
  cpuUtilization:
    idlePercent: 95.57
    systemPercent: 1.1
    userPercent: 3.33
  cpus: 24
  distribution:
    distribution: fedora
    variant: silverblue
    version: "38"
  eventLogger: journald
  hostname: matthew-desktop.local
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 6.2.0-0.rc7.20230208git0983f6bf2bfc.52.fc38.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 72184705024
  memTotal: 134972575744
  networkBackend: cni
  ociRuntime:
    name: crun
    package: crun-1.8-1.fc38.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.8
      commit: 0356bf4aff9a133d655dc13b1d9ac9424706cac4
      rundir: /run/user/1000/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.0-12.fc38.x86_64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 8589930496
  swapTotal: 8589930496
  uptime: 5h 45m 24.00s (Approximately 0.21 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  default-route-openshift-image-registry.apps-crc.testing:
    Blocked: false
    Insecure: true
    Location: default-route-openshift-image-registry.apps-crc.testing
    MirrorByDigestOnly: false
    Mirrors: null
    Prefix: default-route-openshift-image-registry.apps-crc.testing
    PullFromMirror: ""
  search:
  - docker.io
  - quay.io
  - registry.fedoraproject.org
  - registry.access.redhat.com
store:
  configFile: /var/home/matthew/.config/containers/storage.conf
  containerStore:
    number: 10
    paused: 0
    running: 8
    stopped: 2
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/matthew/.local/share/containers/storage
  graphRootAllocated: 998483427328
  graphRootUsed: 696580554752
  graphStatus:
    Backing Filesystem: btrfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 329
  runRoot: /run/user/1000/containers
  transientStore: false
  volumePath: /var/home/matthew/.local/share/containers/storage/volumes
version:
  APIVersion: 4.4.0-rc2
  Built: 1674134600
  BuiltTime: Thu Jan 19 06:23:20 2023
  GitCommit: ""
  GoVersion: go1.20rc3
  Os: linux
  OsArch: linux/amd64
  Version: 4.4.0-rc2

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

No response

Additional information

No response

@matthewpi matthewpi 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.

rhatdan added a commit to rhatdan/podman that referenced this issue Aug 4, 2023
Compat api for containers/stop should take -1 value

Add support for `podman stop --time -1`
Add support for `podman restart --time -1`
Add support for `podman rm --time -1`
Add support for `podman pod stop --time -1`
Add support for `podman pod rm --time -1`
Add support for `podman volume rm --time -1`
Add support for `podman network rm --time -1`

Fixes: containers#17542

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@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 Nov 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 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.

2 participants