Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

tkashem
Copy link
Contributor

@tkashem tkashem commented Dec 10, 2020

What type of PR is this?

/kind bug

What this PR does / why we need it:
clean up executing request on panic

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. 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. 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/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Dec 10, 2020
@tkashem
Copy link
Contributor Author

tkashem commented Dec 10, 2020

/assign @MikeSpreitzer @yue9944882

@fedebongio
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Dec 10, 2020
@tkashem tkashem changed the title clean up executing request on panic [WIP] clean up executing request on panic Dec 10, 2020
@tkashem
Copy link
Contributor Author

tkashem commented Dec 10, 2020

/test all

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 11, 2020
@tkashem tkashem changed the title [WIP] clean up executing request on panic clean up executing request on panic Dec 11, 2020
@tkashem tkashem marked this pull request as ready for review December 11, 2020 17:08
@k8s-ci-robot k8s-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 Dec 11, 2020
@MikeSpreitzer
Copy link
Member

@tkashem : good catch here. And there is more work to do in the same vein. Everything important that callers intend to get done after the request executes should be done in a deferred func. At least, everything important. This includes https://github.com/kubernetes/apiserver/blob/49bd7a412a804b1d5cff38abea1233b54bc6a6d0/pkg/util/flowcontrol/apf_filter.go#L123 and https://github.com/kubernetes/apiserver/blob/49bd7a412a804b1d5cff38abea1233b54bc6a6d0/pkg/util/flowcontrol/apf_filter.go#L129-L131 , and possibly https://github.com/kubernetes/apiserver/blob/49bd7a412a804b1d5cff38abea1233b54bc6a6d0/pkg/util/flowcontrol/apf_filter.go#L128 (arguably not critical because it is only debug logging).

@tkashem
Copy link
Contributor Author

tkashem commented Dec 11, 2020

@MikeSpreitzer thanks for the review, I will address all of the cases above.

Copy link
Member

Choose a reason for hiding this comment

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

I would say "shares" rather than "share". Conventionally "shares" are relative things whose meaning is determined by the number of shares held by other parties --- think "shares" of stock. OTOH, "share" sounds more like an absolute thing --- "my share of the heist is 25%".

Copy link
Member

Choose a reason for hiding this comment

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

Let's use the symbolic constant here rather than repeating the literal for the priority level name.

@tkashem
Copy link
Contributor Author

tkashem commented Dec 18, 2020

@MikeSpreitzer I did a little bit of refactoring, let me know if it looks good to you.

Copy link
Member

Choose a reason for hiding this comment

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

There is no particular "grace" here, it is just waiting for Run to complete.

@MikeSpreitzer
Copy link
Member

MikeSpreitzer commented Dec 18, 2020

I do not like modifying the QueueSet API for this, it makes this a bigger change than necessary. A smaller change would be to modify configController::startRequest to return the QueueSet involved. But...

I really do not like adding a mutex Lock operation to the path of every request. I think a better solution was the previous approach just modified to initialize that "idle" variable to true. You can pursue that approach without naming the returned values from a func.

@tkashem
Copy link
Contributor Author

tkashem commented Dec 18, 2020

I really do not like adding a mutex Lock operation to the path of every request. I think a better solution was the previous approach just modified to initialize that "idle" variable to true.

@MikeSpreitzer this is my preference too, but we would still need the named return value if I am not mistaken.

@MikeSpreitzer
Copy link
Member

#97398 shows how to fix the bug without a named return field.

@tkashem
Copy link
Contributor Author

tkashem commented Dec 19, 2020

#97398 shows how to fix the bug without a named return field.

@MikeSpreitzer thanks for sharing it, I misunderstood - I thought the ask was to return the value of idle when the function panics without using a named return field.

Copy link
Member

@MikeSpreitzer MikeSpreitzer left a comment

Choose a reason for hiding this comment

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

/lgtm
Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 20, 2020
@MikeSpreitzer MikeSpreitzer removed their assignment Dec 20, 2020
@MikeSpreitzer
Copy link
Member

/assign @lavalamp

}
execFn()
return req.qs.finishRequestAndDispatchAsMuchAsPossible(req)
func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks

@deads2k
Copy link
Contributor

deads2k commented Dec 22, 2020

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, MikeSpreitzer, tkashem

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 Dec 22, 2020
@tkashem
Copy link
Contributor Author

tkashem commented Dec 22, 2020

/retest

1 similar comment
@MikeSpreitzer
Copy link
Member

/retest

@k8s-ci-robot k8s-ci-robot merged commit d815833 into kubernetes:master Dec 22, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.21 milestone Dec 22, 2020
k8s-ci-robot added a commit that referenced this pull request Jan 9, 2021
…6-upstream-release-1.20

Automated cherry pick of #97206: clean up executing request on panic
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/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants