Skip to content

Fix the issue where Shutdown doesn't shutdown taskqueue#365

Merged
k8s-ci-robot merged 1 commit intokubernetes:masterfrom
anfernee:fix-queue
Oct 30, 2018
Merged

Fix the issue where Shutdown doesn't shutdown taskqueue#365
k8s-ci-robot merged 1 commit intokubernetes:masterfrom
anfernee:fix-queue

Conversation

@anfernee
Copy link
Copy Markdown
Contributor

Originally, PeriodicTaskQueue has 2 loops:

  • wait.Until managed by stopCh
  • for loop in worker() managed by workqueue

Shutdown only exits the second loop. Failing to close stopCh before
calling Shutdown will cause panic because of double close workDone
channel.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 25, 2018
@rramkumar1
Copy link
Copy Markdown
Contributor

/assign @bowei

@bowei
Copy link
Copy Markdown
Member

bowei commented Jun 27, 2018

Is it possible to add a test for the misbehavior?

Copy link
Copy Markdown
Contributor Author

@anfernee anfernee Jun 29, 2018

Choose a reason for hiding this comment

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

@bowei, the main change is to remove the stopCh from tq. Originally in order to shutdown the tq, we need to close the channel and then call tq.Shutdown(). There is no misbehavior with current implementation, only complexity. e.g. close must happen before shutdown, or it's possible that it won't be shutdown.

In terms of test, I think I can add another shutdown, to make sure no panic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added L56 to test shutdown actually works.

@fejta-bot
Copy link
Copy Markdown

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 27, 2018
@bowei
Copy link
Copy Markdown
Member

bowei commented Oct 14, 2018

can you rebase this?

Originally, PeriodicTaskQueue has 2 loops:
- wait.Until managed by stopCh
- for loop in worker() managed by workqueue

Shutdown only exits the second loop. Failing to close stopCh before
calling Shutdown will cause panic because of double close workDone
channel.
@rramkumar1
Copy link
Copy Markdown
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 30, 2018
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anfernee, rramkumar1

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

The pull request process is described here

Details 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 Oct 30, 2018
@rramkumar1
Copy link
Copy Markdown
Contributor

/retest

@k8s-ci-robot k8s-ci-robot merged commit fdfb8b8 into kubernetes:master Oct 30, 2018
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants