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

reverseproxy: recover from stdlib panic #82586

Closed
wants to merge 1 commit into from

Conversation

@sttts
Copy link
Contributor

commented Sep 11, 2019

The Golang stdlib reverse proxy panics for request contexts coming from an HTTP server. It prints warnings otherwise. Compare https://github.com/golang/go/blob/master/src/net/http/httputil/reverseproxy.go#L295.

In #82146 we switched to the request context, leading to the change panic behaviour.

/kind bug

Avoid panic in the kube-apiserver aggregator when long-running proxied connections are closed.
@sttts

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2019

}
return os.Stderr.Write(p)
defer func() {
recover() // ignore panics inside of the reverse proxy on unclean disconnects

This comment has been minimized.

Copy link
@deads2k

deads2k Sep 11, 2019

Contributor

klog.V(4) so we have some shot at debugging "weird" issues if they come up?

This comment has been minimized.

Copy link
@liggitt

liggitt Sep 11, 2019

Member

why isn't our existing WithPanicRecovery handling this already?

This comment has been minimized.

Copy link
@liggitt

liggitt Sep 11, 2019

Member

also, if we're using this as an expected control mechanism, I'd expect catching/comparing with http.ErrAbortHandler, and propagating the panic otherwise (preserving the original stack as we do in other places we catch/propagate)

This comment has been minimized.

Copy link
@sttts

sttts Sep 11, 2019

Author Contributor

it handles it, but prints it, giving you hundred of panics in the logs

This comment has been minimized.

Copy link
@liggitt

liggitt Sep 11, 2019

Member

ah. looks like if we're going to inject ourselves into http server panic handling, we have to honor http.ErrAbortHandler:

ErrAbortHandler is a sentinel panic value to abort a handler. While any panic from ServeHTTP aborts the response to the client, panicking with ErrAbortHandler also suppresses logging of a stack trace to the server's error log.

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

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

@sttts sttts force-pushed the sttts:sttts-reverseproxy-panic branch from 6862e05 to 2ca970e Sep 11, 2019
@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2019

@sttts: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-gce 2ca970e link /test pull-kubernetes-e2e-gce
pull-kubernetes-integration 2ca970e link /test pull-kubernetes-integration

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@josiahbjorgaard

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2019

Bug Triage team on 1.16 release here. Since we have passed code freeze, PRs intended for 1.16 will need to go through approval to be cherry-picked. Since this PR is not flagged critical-urgent, we recommend moving it to milestone 1.17. Cherry-pick deadline for PRs on 1.16 is tomorrow EOD.

@liggitt

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

closing in favor of #82588
/close

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2019

@liggitt: Closed this PR.

In response to this:

closing in favor of #82588
/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
You can’t perform that action at this time.