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 /containers/{id}/wait doesn't work with correct condition enumeration #8697

Closed
matejvasek opened this issue Dec 11, 2020 · 6 comments · Fixed by #9048
Closed

APIv2 /containers/{id}/wait doesn't work with correct condition enumeration #8697

matejvasek opened this issue Dec 11, 2020 · 6 comments · Fixed by #9048
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@matejvasek
Copy link
Contributor

Currently the used enumeration is here:
podman/libpod/define/containerstate.go

const (
	ContainerStateUnknown ContainerStatus = iota
	ContainerStateConfigured ContainerStatus = iota
	ContainerStateCreated ContainerStatus = iota
	ContainerStateRunning ContainerStatus = iota
	ContainerStateStopped ContainerStatus = iota
	ContainerStatePaused ContainerStatus = iota
	ContainerStateExited ContainerStatus = iota
	ContainerStateRemoving ContainerStatus = iota
)

But docker uses different values:

const (
	WaitConditionNotRunning WaitCondition = "not-running"
	WaitConditionNextExit   WaitCondition = "next-exit"
	WaitConditionRemoved    WaitCondition = "removed"
)
@matejvasek
Copy link
Contributor Author

Calls like this fails.

POST /v1.38/containers/ctrId/wait?condition=next-exit

@matejvasek
Copy link
Contributor Author

I could work on this if nobody else wants to.

@rhatdan
Copy link
Member

rhatdan commented Dec 14, 2020

You got it.

@rhatdan rhatdan added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Dec 14, 2020
@github-actions
Copy link

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

@rhatdan
Copy link
Member

rhatdan commented Jan 14, 2021

@matejvasek Any progress?

@matejvasek
Copy link
Contributor Author

@rhatdan I should get to this soon. I think I could get PR sometimes next week.

Unfortunately, before starting working directly on this I spent (or wasted?) some time on related issue.
I really didn't like the idea of checking state of a container every 250ns. I was trying do add some kind of notification mechanism to lock.Locker, something like condition variable. Long story short: it didn't work.

There is a problem when waiting process is forcefully killed, like with SIGKILL (however SIGTERM or SIGINT can be handled).
First I tried to use standard posix cond var. The issues is that posix cond var is not robust.
Then I tried to write my own cond var using semaphores,
but there would be a small memory leak anytime waiting process dies.
Last but not least, this would work only with SHM lock, not FS locks.

@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
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. 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