Open daisy-ycguo opened 4 years ago
There is an issue with --log-http
and event streams. Will go into mores details later (but its about that the logging will consume the whole response stream first, so that events are not distributed internally), but jusr at a conference, will be back at knative work on friday.
just hit this today too....
The issue is that for logging with http, the HTTP response body is consumed to print out, but when in a watch situation, the response is a stream, so that logging only finished when the stream is finished. Which is far too late. Logging needs to be adapted, probably skipping to print out the response body and concentrating on headers and other meta info.
Alternatively instead of tweaking how logging works we could change the hanging get to polling at: https://github.com/knative/client/blob/963788b7309ec3d538349222bad7b10403f9c134/pkg/wait/poll_watcher.go#L70-L78 if the --log-http
flag was provided
Polling should be only the second choice, for performance reasons (but is required on Google Cloud Run AFAIU). So we need to deal with this general way how watches work in K8s.
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.
Still a bug
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.
/remove-lifecycle stale
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.
/remove-lifecycle stale
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.
/remove-lifecycle stale
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.
/remove-lifecycle stale
Hi, I am curious about this issue. While looking into how watch with log stream work, I tried with no body outputs and it was working as follow. Let me make sure if response body is required.
$ go run cmd/kn/main.go service create hello \
--image gcr.io/knative-samples/helloworld-go \
--port 8080 \
--env TARGET=World \
--revision-name=world \
--log-http
===== REQUEST =====
GET /apis/serving.knative.dev/v1/namespaces/default/services/hello HTTP/1.1
Host: 127.0.0.1:45799
User-Agent: main/v0.0.0 (linux/amd64) kubernetes/$Format
Accept: application/json, */*
Accept-Encoding: gzip
===== RESPONSE =====
HTTP/2.0 404 Not Found
Content-Length: 236
Audit-Id: f035b327-1ccc-4763-896d-aaba44731775
Cache-Control: no-cache, private
Content-Type: application/json
Date: Thu, 03 Feb 2022 05:20:25 GMT
X-Kubernetes-Pf-Flowschema-Uid: e8ebe5d2-80f7-41ff-9c3d-559a863e6c5e
X-Kubernetes-Pf-Prioritylevel-Uid: f4fe3087-c02a-4d34-89ac-e5581a0a36f4
* * * * * *
===== REQUEST =====
POST /apis/serving.knative.dev/v1/namespaces/default/services HTTP/1.1
Host: 127.0.0.1:45799
User-Agent: main/v0.0.0 (linux/amd64) kubernetes/$Format
Content-Length: 545
Accept: application/json, */*
Content-Type: application/json
Accept-Encoding: gzip
===== RESPONSE =====
HTTP/2.0 201 Created
Content-Length: 1378
Audit-Id: 1058e2d9-844f-484f-a0f2-4ac25b31b8ed
Cache-Control: no-cache, private
Content-Type: application/json
Date: Thu, 03 Feb 2022 05:20:25 GMT
X-Kubernetes-Pf-Flowschema-Uid: e8ebe5d2-80f7-41ff-9c3d-559a863e6c5e
X-Kubernetes-Pf-Prioritylevel-Uid: f4fe3087-c02a-4d34-89ac-e5581a0a36f4
* * * * * *
Creating service 'hello' in namespace 'default':
===== REQUEST =====
GET /apis/serving.knative.dev/v1/namespaces/default/services/hello HTTP/1.1
Host: 127.0.0.1:45799
User-Agent: main/v0.0.0 (linux/amd64) kubernetes/$Format
Accept: application/json, */*
Accept-Encoding: gzip
===== RESPONSE =====
HTTP/2.0 200 OK
Content-Length: 1378
Audit-Id: d985521d-a176-4775-a224-3da0db253f5e
Cache-Control: no-cache, private
Content-Type: application/json
Date: Thu, 03 Feb 2022 05:20:25 GMT
X-Kubernetes-Pf-Flowschema-Uid: e8ebe5d2-80f7-41ff-9c3d-559a863e6c5e
X-Kubernetes-Pf-Prioritylevel-Uid: f4fe3087-c02a-4d34-89ac-e5581a0a36f4
* * * * * *
===== REQUEST =====
GET /apis/serving.knative.dev/v1/namespaces/default/services?fieldSelector=metadata.name%3Dhello&resourceVersion=17284912&timeout=10m30s&timeoutSeconds=630&watch=true HTTP/1.1
Host: 127.0.0.1:45799
User-Agent: main/v0.0.0 (linux/amd64) kubernetes/$Format
Accept: application/json, */*
Accept-Encoding: gzip
===== RESPONSE =====
HTTP/2.0 200 OK
Connection: close
Audit-Id: 0d284d3d-91fa-4319-842c-9c2dc949f2f9
Cache-Control: no-cache, private
Content-Type: application/json
Date: Thu, 03 Feb 2022 05:20:25 GMT
X-Kubernetes-Pf-Flowschema-Uid: e8ebe5d2-80f7-41ff-9c3d-559a863e6c5e
X-Kubernetes-Pf-Prioritylevel-Uid: f4fe3087-c02a-4d34-89ac-e5581a0a36f4
* * * * * *
0.012s The Configuration is still working to reflect the latest desired specification.
0.040s The Route is still working to reflect the latest desired specification.
0.065s Configuration "hello" is waiting for a Revision to become ready.
3.226s ...
3.251s Ingress has not yet been reconciled.
3.281s Waiting for load balancer to be ready
3.525s Ready to serve.
===== REQUEST =====
GET /apis/serving.knative.dev/v1/namespaces/default/services/hello HTTP/1.1
Host: 127.0.0.1:45799
User-Agent: main/v0.0.0 (linux/amd64) kubernetes/$Format
Accept: application/json, */*
Accept-Encoding: gzip
===== RESPONSE =====
HTTP/2.0 200 OK
Content-Length: 2128
Audit-Id: 677b0d4a-71d1-4f29-aaa6-e91ca82b3508
Cache-Control: no-cache, private
Content-Type: application/json
Date: Thu, 03 Feb 2022 05:20:29 GMT
X-Kubernetes-Pf-Flowschema-Uid: e8ebe5d2-80f7-41ff-9c3d-559a863e6c5e
X-Kubernetes-Pf-Prioritylevel-Uid: f4fe3087-c02a-4d34-89ac-e5581a0a36f4
* * * * * *
Service 'hello' created to latest revision 'hello-world' is available at URL:
http://hello.default.127.0.0.1.sslip.io
$
What version of Knative Client?
$ ./kn version Version: v20191106-local-f1f6cfb-dirty Build Date: 2019-11-06 06:51:12 Git Revision: f1f6cfb Supported APIs:
What version of Knative Serving running on your cluster?
I don't know
Expected Behavior
./kn service create --image docker.io/ibmcom/fib-knative fib-knative --log-http
could response correctly and print http logs to standard output.Actual Behavior
./kn service create --image docker.io/ibmcom/fib-knative fib-knative --log-http
keeps pending for 10 minutes and response a timeout error. But,./kn service create --image docker.io/ibmcom/fib-knative fib-knative
could response correctly.Steps to Reproduce the Problem
Call
./kn service create --image docker.io/ibmcom/fib-knative fib-knative --log-http
, it keeps pending and response timeout after 10 minutes.The output of
./kn service create --image docker.io/ibmcom/fib-knative fib-knative
looks as below: