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

agnhost: fix sigterm shutdown #110212

Merged
merged 1 commit into from May 25, 2022
Merged

Conversation

aojea
Copy link
Member

@aojea aojea commented May 25, 2022

/kind bug
/kind failing-test
/kind flake
/kind regression

NONE

When adding the new readyz handler to the agnhost netexec functionality
#110174
we forget to handle the case when a SIGTERM is received but not shutdown delay is set, causing the process to hang forever without exiting, this is making some test to fail. https://storage.googleapis.com/k8s-triage/index.html?sig=network#7ccacb7807a6b800df8c

Since we are always handling the SIGTERM signal now, just exit immediately if not shutdown-delay option is set,

How to repro

cd test/images/agnhost
CGO_ENABLED=0 go build .
./agnhost netexec 
I0525 12:19:24.160983 1873100 log.go:184] Started HTTP server on port 8080
I0525 12:19:24.161146 1873100 log.go:184] Started UDP server on port  8081

in another terminal send a kill -SIGTERM , the process never dies

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. kind/flake Categorizes issue or PR as related to a flaky test. kind/regression Categorizes issue or PR as related to a regression from a prior release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 25, 2022
@k8s-ci-robot
Copy link
Contributor

@aojea: This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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 needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 25, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aojea

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 25, 2022
@aojea
Copy link
Member Author

aojea commented May 25, 2022

https://storage.googleapis.com/k8s-triage/index.html?sig=network#7ccacb7807a6b800df8c

things started to fail on these tests, that use the healthz endpoint for readiness, this is breaking the behavior, a SIGTERM never exits

/priority critical-urgent
/assign @liggitt @deads2k

@k8s-ci-robot k8s-ci-robot added the priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. label May 25, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label May 25, 2022
Comment on lines 183 to 185
os.Exit(0)
}()
}
}
// SIGTERM Exit Code 143
os.Exit(143)
Copy link
Member Author

Choose a reason for hiding this comment

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

I have doubts about the exit codes, I've verified that previously, sending a SIGTERM the exit code is a 143

./agnhost netexec 
I0525 12:19:24.160983 1873100 log.go:184] Started HTTP server on port 8080
I0525 12:19:24.161146 1873100 log.go:184] Started UDP server on port  8081
Terminated
$ echo $?
143

if that is correct, the previous exit code to 0 was wrong

Copy link
Member Author

Choose a reason for hiding this comment

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

my google search says that the right way is to set it to 0,

Copy link
Member Author

Choose a reason for hiding this comment

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

@deads2k
Copy link
Contributor

deads2k commented May 25, 2022

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 25, 2022
@aojea
Copy link
Member Author

aojea commented May 25, 2022

Test_Run_OneVolumeDetachFailNodeWithReadWriteOnce

/test pull-kubernetes-unit

@k8s-ci-robot k8s-ci-robot merged commit 1290d6a into kubernetes:master May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/failing-test Categorizes issue or PR as related to a consistently or frequently failing test. kind/flake Categorizes issue or PR as related to a flaky test. kind/regression Categorizes issue or PR as related to a regression from a prior release. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants