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

Apply timeout in the queue proxy on 'time to first byte'. #2696

Merged
merged 10 commits into from
Dec 15, 2018

Conversation

markusthoemmes
Copy link
Contributor

Fixes #2582

Proposed Changes

  • Implemented a custom timeout handler (based on http.TimeoutHandler), that applies a timeout, if no bytes have been written to the connection for timeout time.

@tanzeeb this includes setting the StatusCode at the moment, but we can strip that out to only include Write calls, if that makes more sense?

Release Note

The revision's timeout is now interpreted as 'time to first byte', to support streaming cases.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 11, 2018
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@markusthoemmes: 0 warnings.

In response to this:

Fixes #2582

Proposed Changes

  • Implemented a custom timeout handler (based on http.TimeoutHandler), that applies a timeout, if no bytes have been written to the connection for timeout time.

@tanzeeb this includes setting the StatusCode at the moment, but we can strip that out to only include Write calls, if that makes more sense?

Release Note

The revision's timeout is now interpreted as 'time to first byte', to support streaming cases.

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.

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 11, 2018
@steuhs
Copy link
Contributor

steuhs commented Dec 11, 2018

/test pull-knative-serving-go-coverage

@markusthoemmes
Copy link
Contributor Author

/assign @tcnghia
/assign @mattmoor
/cc @tanzeeb

@markusthoemmes
Copy link
Contributor Author

/test pull-knative-serving-go-coverage

pkg/queue/timeout.go Show resolved Hide resolved
pkg/queue/timeout.go Show resolved Hide resolved
pkg/queue/timeout.go Show resolved Hide resolved
pkg/queue/timeout.go Show resolved Hide resolved
pkg/queue/timeout.go Show resolved Hide resolved
pkg/queue/timeout.go Outdated Show resolved Hide resolved
@markusthoemmes
Copy link
Contributor Author

/test pull-knative-serving-integration-tests

for {
select {
case p := <-panicChan:
panic(p)
Copy link
Member

Choose a reason for hiding this comment

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

I believe this leaks done on this and the timeout path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it only leaks here. The timeout path cancels the context. That doesn't make it panic so the handler's close(done) call is properly reached. To be sure, I tried adding a close call to the timeout path and that errored due to multiple close calls.

done := make(chan struct{})
// The recovery value of a panic is written to this channel to be
// propagated (panicked with) again.
panicChan := make(chan interface{}, 1)
Copy link
Member

Choose a reason for hiding this comment

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

This still isn't closed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://stackoverflow.com/a/8593986/3269863 suggests that channels don't need to be closed (that is: if you don't need to use the close as a signal as well).

I still pushed a commit to close the channels appropriately.

@knative-prow-robot knative-prow-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 14, 2018
@knative-metrics-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/queue/timeout.go Do not exist 97.8%

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 15, 2018
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markusthoemmes, mattmoor

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 15, 2018
@knative-prow-robot knative-prow-robot merged commit 7aab273 into knative:master Dec 15, 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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants