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

Set StopTimeout for compat API if not set by client #19704

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Aug 22, 2023

Currently containers created via DOCKER API without specifying
StopTimeout are defaulting to 0 seconds. This change should
default them to setting in containers.conf normally 10 seconds.

Fixes: #19139

Set StopTimeout for service-container started under podman kube play

Fixes: #19139

Service containers are defaulting to 0 seconds for Timeout rather then
the settings in containers.conf.

Does this PR introduce a user-facing change?

Containers created via compat API default to 10 seconds or containers.conf setting.

@openshift-ci openshift-ci bot added release-note approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 22, 2023
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Aug 22, 2023
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -72,7 +76,8 @@ func (ic *ContainerEngine) createServiceContainer(ctx context.Context, name stri
ReadOnly: true,
ReadWriteTmpFS: false,
// No need to spin up slirp etc.
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
StopTimeout: rtc.Engine.StopTimeout,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reporter actually caught it.

Copy link
Member Author

@rhatdan rhatdan Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it without a fried brain: I am not sure the stop timeout makes that much sense for a service container. There is no workload inside other than catatonit. But catatonit handles SIGTERM just fine so I don't expect any measurable negative performance impact on shut down.

Comment on lines 494 to 495
run_podman container inspect --format '{{.Config.StopTimeout}}' $service_container
is "$output" "10" "StopTimeout should be initialized to 10"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting run eighteen times. Could there maybe be a better place to do this check?

(I'd love to find it myself but am currently rabbitholing into a weird "Closing sdnotify proxy ... unixgram" error)

@@ -308,6 +308,7 @@ cid_top=$(jq -r '.Id' <<<"$output")
t GET containers/${cid_top}/json 200 \
.Config.Entrypoint[0]="top" \
.Config.Cmd='[]' \
.Config.StopTimeput="10" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo Timeout, I guess this is why the tests fails

@mheon
Copy link
Member

mheon commented Aug 23, 2023

Code LGTM

@TomSweeneyRedHat
Copy link
Member

Code LGTM
Tests are still unhappy

@rhatdan
Copy link
Member Author

rhatdan commented Aug 24, 2023

All bud tests are blowing up because of the removal of podmanhello.

commit 7e0130f75cc27ae32d8843a8be8d2588aa2dcee9
Author: Chris Evich <[email protected]>
Date:   Wed Aug 23 12:10:13 2023 -0400

    Remove `hello` multi-arch image build
    
    Moved to https://github.com/containers/PodmanHello
    
    Signed-off-by: Chris Evich <[email protected]>

Currently containers created via DOCKER API without specifying
StopTimeout are defaulting to 0 seconds. This change should
default them to setting in containers.conf normally 10 seconds.

Fixes: containers#19139

Signed-off-by: Daniel J Walsh <[email protected]>
Fixes: containers#19139

Service containers are defaulting to 0 seconds for Timeout rather then
the settings in containers.conf.

Signed-off-by: Daniel J Walsh <[email protected]>
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@@ -72,7 +76,8 @@ func (ic *ContainerEngine) createServiceContainer(ctx context.Context, name stri
ReadOnly: true,
ReadWriteTmpFS: false,
// No need to spin up slirp etc.
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
Net: &entities.NetOptions{Network: specgen.Namespace{NSMode: specgen.NoNetwork}},
StopTimeout: rtc.Engine.StopTimeout,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it without a fried brain: I am not sure the stop timeout makes that much sense for a service container. There is no workload inside other than catatonit. But catatonit handles SIGTERM just fine so I don't expect any measurable negative performance impact on shut down.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, vrothberg

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-merge-robot openshift-merge-robot merged commit 584c1e7 into containers:main Aug 25, 2023
@rhatdan
Copy link
Member Author

rhatdan commented Aug 25, 2023

I thought the reporter noticed an issue on the service timeout, exiting before the containers and pods had a chance to cleanup.

@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 24, 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. kind/api-change Change to remote API; merits scrutiny 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. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Containers created using docker compose have StopTimeout set to 0
7 participants