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

nginx-ingress-controller sleeps for 10 seconds before exiting #8095

Closed
rittneje opened this issue Jan 3, 2022 · 8 comments
Closed

nginx-ingress-controller sleeps for 10 seconds before exiting #8095

rittneje opened this issue Jan 3, 2022 · 8 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@rittneje
Copy link

rittneje commented Jan 3, 2022

For some reason, during shutdown nginx-ingress-controller sleeps for 10 seconds after shutting down nginx.

exitCode := 0
if err := ngx.Stop(); err != nil {
klog.Warningf("Error during shutdown: %v", err)
exitCode = 1
}
klog.InfoS("Handled quit, awaiting Pod deletion")
time.Sleep(10 * time.Second)
klog.InfoS("Exiting", "code", exitCode)
exit(exitCode)

This seems entirely pointless, and only serves to make pod shutdown take longer.

The only benefit I can think of is it gives the pre-stop hook time to do any other actions after /wait-shutdown, since once pid 1 exits all other processes are immediately killed. But if that's the intent, (1) it should be configurable, and (2) the log message should be amended.

@rittneje rittneje added the kind/bug Categorizes issue or PR as related to a bug. label Jan 3, 2022
@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority labels Jan 3, 2022
@strongjz
Copy link
Member

strongjz commented Jan 4, 2022

/priority backlog
/triage accepted
/kind feature
/assign @theunrealgeek

@k8s-ci-robot
Copy link
Contributor

@strongjz: GitHub didn't allow me to assign the following users: theunrealgeek.

Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

/priority backlog
/triage accepted
/kind feature
/assign @theunrealgeek

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. triage/accepted Indicates an issue or PR is ready to be actively worked on. kind/feature Categorizes issue or PR as related to a new feature. and removed needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 4, 2022
@theunrealgeek
Copy link
Contributor

/assign

@theunrealgeek
Copy link
Contributor

Thanks for bringing this up. I looked into this a little more than this was the commit 4 years ago that introduced the 10 second sleep but I can't find any good reasoning for it either. ngx.Stop() a few lines above is already waiting for all nginx processes to exit.

(1) it should be configurable

I agree that it should be configurable, so a PR is welcome if you like to make it.

and (2) the log message should be amended.

Technically the message isn't wrong, do you have suggestions on what it should be?

@rittneje
Copy link
Author

@theunrealgeek To mean the current log message implies that it is waiting for some event from the control plane. Something like "Handled quit, delaying container exit for %s" would be more clear.

@theunrealgeek
Copy link
Contributor

@rittneje The feature to be able to configure the delay period was merged and should be available in a future release. Thanks

@strongjz
Copy link
Member

/close

@k8s-ci-robot
Copy link
Contributor

@strongjz: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

4 participants