-
Notifications
You must be signed in to change notification settings - Fork 294
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
Requests hang if watch=true and there are no objects matching query #263
Comments
I think it is by design. Maybe the better solution is to wrap List and Watch into one sugared watch What do you think? |
@tg123 This is essentially what I am now doing, but it makes it all more difficult than it needs to be. Essentially having to translate the async-based List call into working the same way as the callback-based Watch call. However I think it is possible to implement the List call so it returns immediately if watch is true. I implemented it as a test by having the LineSeparatedHttpContent.SerializeToStreamAsync method not bother peeking the stream, which makes the HttpContent stream (as returned by HttpContent.ReadAsStreamAsync) empty, rather than the first line of the watch result. It works for my purposes, but I'm not sure what doing that might break in the rest of the client. |
List and Watch should be separate calls... |
call |
@tg123 |
@corruptmem Yes, that seems to be correct. We should be able to just update the It'd involve updating the Would you want to pop a PR for that? |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closing this issue. In response to this:
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. |
To reproduce:
Expected: Output FOO, BAR, WATCHING then as any new pods get created, for the event to be printed
Actual: Outputs FOO then the program hangs until at least one pod gets created
If you comment out the labelSelector, the problem goes away - presumably unless you had a Kubernetes cluster with no pods in the default namespace.
Although it is possible to workaround this by treating the ListNamespacedPodWithHttpMessagesAsync (and similar) calls as taking an indefinite time to return under normal circumstances, it's not what I expected to happen when using the watcher.
The root cause of the issue appears to be the LineSeparatedHttpContent class used in the WatcherDelegatingHandler. It appears that inside SerializeToStreamAsync it "peeks" the first line which then calls ReadLineAsync and blocks until there's something to read.
The text was updated successfully, but these errors were encountered: