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

exec: get the exit code from sync pipe instead of file #5373

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

haircommander
Copy link
Collaborator

@haircommander haircommander commented Mar 2, 2020

Before, we were getting the exit code from the file, in which we waited an arbitrary amount of time (5 seconds) for the file, and segfaulted if we didn't find it. instead, we should be a bit more certain conmon has sent the exit code. Luckily, it sends the exit code along the sync pipe fd, so we can read it from there

Adapt the ExecContainer interface to pass along a channel to get the pid and exit code from conmon, to be able to read both from the pipe

Also slightly change the way we report a bogus value when failing to read from the conmon pipe. we now set it to a value that cannot be a valid pid * -1, to make sure we correctly report the place an error comes from

Signed-off-by: Peter Hunt pehunt@redhat.com

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/L labels Mar 2, 2020
@haircommander haircommander force-pushed the exec-pipe-ec branch 2 times, most recently from f1b0e33 to edab75f Compare March 2, 2020 20:10
@baude
Copy link
Member

baude commented Mar 2, 2020

/approve

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: baude, haircommander

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 2, 2020
@baude
Copy link
Member

baude commented Mar 2, 2020

code lgtm

@mheon
Copy link
Member

mheon commented Mar 2, 2020 via email

@haircommander
Copy link
Collaborator Author

haircommander commented Mar 3, 2020

This may cause issues with my detached exec code for APIv2 - how do we source exit codes there?

it would probably take an entirely different code path. We only wait on the exit code when we are attached to it. In updating the exec exit code (for an podman exec list or something, whatever the api will be for listing a container's exec session), we could check for the existence of the exit code via file.

If need be, we could even save the pipe fd in the db or the location of the file, and open it as needed. This PR should fit right into your exec rework PR as is, and we can logic through how detach works with this when you get there. But for now this solves an immediate CI flake, so I'm inclined to go forward and think about reworks later.

Before, we were getting the exit code from the file, in which we waited an arbitrary amount of time (5 seconds) for the file, and segfaulted if we didn't find it. instead, we should be a bit more certain conmon has sent the exit code. Luckily, it sends the exit code along the sync pipe fd, so we can read it from there

Adapt the ExecContainer interface to pass along a channel to get the pid and exit code from conmon, to be able to read both from the pipe

Signed-off-by: Peter Hunt <pehunt@redhat.com>
Before, we were using -1 as a bogus value in podman to signify something went wrong when reading from a conmon pipe. However, conmon uses negative values to indicate the runtime failed, and return the runtime's exit code.

instead, we should use a bogus value that is actually bogus. Define that value in the define package as MinInt32 (-1<< 31 - 1), which is outside of the range of possible pids (-1 << 31)

Signed-off-by: Peter Hunt <pehunt@redhat.com>
@haircommander haircommander changed the title WIP exec: get the exit code from sync pipe instead of file exec: get the exit code from sync pipe instead of file Mar 3, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 3, 2020
@haircommander
Copy link
Collaborator Author

This is ready

@rhatdan
Copy link
Member

rhatdan commented Mar 4, 2020

LGTM

@baude
Copy link
Member

baude commented Mar 4, 2020

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 4, 2020
@baude
Copy link
Member

baude commented Mar 4, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 4, 2020
@baude
Copy link
Member

baude commented Mar 4, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 4, 2020
@openshift-merge-robot openshift-merge-robot merged commit 8389552 into containers:master Mar 4, 2020
mheon added a commit to mheon/libpod that referenced this pull request Mar 9, 2020
This reverts commit 4632b81.

We are reverting containers#5373 as well, which lays the foundation for
this commit, so it has to go as well.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
@mheon mheon mentioned this pull request Mar 9, 2020
snj33v pushed a commit to snj33v/libpod that referenced this pull request May 31, 2020
This reverts commit 4632b81.

We are reverting containers#5373 as well, which lays the foundation for
this commit, so it has to go as well.

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 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. 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 this pull request may close these issues.

6 participants