Expected Behavior
When I deploy an application with the timeoutSeconds, I expect the timeout to only apply from when the request is sent until the response response begins.
Actual Behavior
When I deploy an application with the timeoutSeconds set, eg. "45s", I the timeout applies from when the request is sent until the response response ends.
Steps to Reproduce the Problem
- Modify the
knative/serving/test/test_images/timeout application as follows:
func handler(w http.ResponseWriter, r *http.Request) {
before, _ := strconv.Atoi(r.URL.Query().Get("before"))
after, _ := strconv.Atoi(r.URL.Query().Get("after"))
time.Sleep(time.Duration(before) * time.Second)
fmt.Fprintf(w, "Begin after %d seconds", before)
time.Sleep(time.Duration(after) * time.Second)
fmt.Fprintf(w, "End after %d seconds", after)
}
- Deploy with the following
service.yaml:
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
name: timeout
namespace: default
spec:
runLatest:
configuration:
revisionTemplate:
spec:
timeoutSeconds: "30s"
container:
image: github.com/knative/serving/test/test_images/timeout
- Curl the service a query parameter less than the timeout
?before=15&after=45. This will fail, but should not fail.
- Curl the service a query parameter less than the timeout
?before=45&after=15. This will fail, and should fail.
Additional Info
The current implementation uses http.TimeoutHandler, which will buffer the entire request. This poses problems for streaming requests, eg. gRPC in #2539.
cc @tcnghia @mattmoor @evankanderson
Expected Behavior
When I deploy an application with the
timeoutSeconds, I expect the timeout to only apply from when the request is sent until the response response begins.Actual Behavior
When I deploy an application with the
timeoutSecondsset, eg. "45s", I the timeout applies from when the request is sent until the response response ends.Steps to Reproduce the Problem
knative/serving/test/test_images/timeoutapplication as follows:service.yaml:?before=15&after=45. This will fail, but should not fail.?before=45&after=15. This will fail, and should fail.Additional Info
The current implementation uses
http.TimeoutHandler, which will buffer the entire request. This poses problems for streaming requests, eg. gRPC in #2539.cc @tcnghia @mattmoor @evankanderson