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

Errors are not reported when starting a pod from the REST API #8865

Closed
fstephany opened this issue Jan 2, 2021 · 2 comments · Fixed by #9188
Closed

Errors are not reported when starting a pod from the REST API #8865

fstephany opened this issue Jan 2, 2021 · 2 comments · Fixed by #9188
Assignees
Labels
HTTP API Bug is in RESTful API In Progress This issue is actively being worked by the assignee, please do not work on this at this time. 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

@fstephany
Copy link

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

/kind bug

Description

Errors are not reported when starting a pod from the REST API.

Steps to reproduce the issue:

  1. Start a Pod using a port mapping (e.g., 8080:80).
  2. Start another pod using the same port mapping as the previous one with the CLI. This result in an expected bind error:
$ podman pod start second-pod 
error starting container 47ab04855d52b81fc4245e4abb8a6f04933518e865d0aca695b65effc3193aee: rootlessport listen tcp 0.0.0.0:8080: bind: address already in use
Error: error starting container d6efdf7a7d2366e8af67deea417a98c3235fdcccbb8ecf99ca4babb23782e91c: a dependency of container d6efdf7a7d2366e8af67deea417a98c3235fdcccbb8ecf99ca4babb23782e91c failed to start: container state improper
  1. Start a podman daemon: $ podman system service -t 0 tcp:127.0.0.1:1234
  2. Try to start the same pod with the REST API:
$ curl -X POST -s 'http://localhost:1234/v2.0.0/libpod/pods/second-pod/start'
{"Errs":[{},{}],"Id":"3568556cd9b293a53f2ce3ff98d9bea58929a7f2ac41cebf575f958079dcf061"}

Describe the results you received:

The Errs property contains empty objects instead of the expected string (as described in the reference).

Output of podman version:

Podman running on Fedora 33.

$ podman version
Version:      2.2.1
API Version:  2.1.0
Go Version:   go1.15.5
Built:        Tue Dec  8 15:37:50 2020
OS/Arch:      linux/amd64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

No

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 2, 2021
@rhatdan
Copy link
Member

rhatdan commented Jan 4, 2021

@jwhonce PTAL

@baude baude self-assigned this Jan 4, 2021
@baude baude added In Progress This issue is actively being worked by the assignee, please do not work on this at this time. and removed In Progress This issue is actively being worked by the assignee, please do not work on this at this time. labels Jan 4, 2021
@baude
Copy link
Member

baude commented Jan 4, 2021

we are getting a partial fail error back in this case. but then we still return an OK. That is easy to fix, but it also looks like the encoder is eating/throwing away the slice of errs. i need @jwhonce to advise here and then fix should be easy.

@jwhonce jwhonce assigned jwhonce and unassigned baude Jan 13, 2021
@jwhonce jwhonce added HTTP API Bug is in RESTful API In Progress This issue is actively being worked by the assignee, please do not work on this at this time. labels Jan 13, 2021
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 1, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 1, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 1, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 2, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 2, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 2, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 2, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 2, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 2, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
jwhonce added a commit to jwhonce/podman that referenced this issue Feb 2, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

- Fix test_resize() result check

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>
mheon pushed a commit to mheon/libpod that referenced this issue Feb 4, 2021
- When one or more containers in the Pod reports an error on an operation
report StatusConflict and report the error(s)

- jsoniter type encoding used to marshal error as string using error.Error()

- Update test framework to allow setting any flag when creating pods

- Fix test_resize() result check

Fixes containers#8865

Signed-off-by: Jhon Honce <jhonce@redhat.com>

<MH: Fix cherry-pick conflicts>

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
HTTP API Bug is in RESTful API In Progress This issue is actively being worked by the assignee, please do not work on this at this time. 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.

5 participants