GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Shutdown Websocket Connections Gracefully in the queue-proxy by dprotaso · Pull Request #16362 · knative/serving Conversation
Member
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
|
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@ ## main #16362 +/- ## ========================================== + Coverage 80.18% 80.22% +0.03% ========================================== Files 216 217 +1 Lines 13440 13507 +67 ========================================== + Hits 10777 10836 +59 - Misses 2298 2306 +8 Partials 365 365 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
One observation I have is that the activator will drop hijacked connections similar to the queue proxy. Hijacking happens implicitly with the The solution in the queue-proxy is straight forward because we know K8s will send a TERM signal to the user container - thus we can expect apps to return a close frame when that happens. Those are the changes I made to our websocket server. This isn't necessary but just maybe it's a good practice With the activator though - there's no way to signal downstream to end the connection. We maybe could send a close frame on the connection but it makes the activator protocol aware and I don't think we can write a message on an upstream connection like this (it could be interleaved with another). Given this - I don't think the activator issue should prevent this change from merging - but just the solution there isn't straighforward. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/retest hmm
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
9f80c61 to
cd8e486
Compare
b889e35 to
b434a0a
Compare
|
/retest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
411fe17 to
55df508
Compare
| gotestsum --format testname -- \ | ||
| -race -count=1 -parallel=1 -tags=e2e \ | ||
| -timeout=30m \ | ||
| -timeout=35m \ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
With the extra test we need to bump this since we run things with -parallel=1 due to github actions default runners being crappy.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I adjusted the test to not use time.Sleep to speed it up
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe not that relevant for this PR but timing tests could also be sped up using synctest after requiring go 1.25, see https://go.dev/blog/testing-time
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Not for e2e. It would run faster if we ran tests in parallel - but with kind+github action runners they are so under provisioned that tests flake out etc.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/assign @linkvt @elijah-rou |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@dprotaso: GitHub didn't allow me to assign the following users: elijah-rou. Note that only knative members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. DetailsIn 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-sigs/prow repository. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me in general, took me a while to figure out the concurrency and what is actually tested, I left a few minor comments though.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| <-inHandler | ||
| close(drainStarted) | ||
| drainResult <- h.Drain(context.Background()) | ||
| }() | ||
|
|
||
| <-drainStarted | ||
| close(handlerWait) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if this always behaves as expected, couldn't a potential sequence be:
Should this test verify that drain works correctly when a connection is closed after the tracker was asked to Drain?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You think I should add a sleep in-between drainStarted being unblocked and closing handlerWait?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think I was thinking that close(drainStarted) wouldn't yield the go-routine so the drain does start but I don't believe there is a guarantee like that in Go
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes I think we can remove drainStarted, move <-inHandler out of the second goroutine between the two goroutines and add a sleep before close(handlerWait).
This way the handler would start, unblock <-inHandler, start the goroutine to drain, sleep in the test func so that Drain will run the loop a few times before close(handlerWait) lets the handler finish.
Edit: We could even add a select to check whether <-drainResult has received a value before this sleep passes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
done - take a look
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| <-inHandler | ||
| close(drainStarted) | ||
| drainResult <- h.Drain(context.Background()) | ||
| }() | ||
|
|
||
| <-drainStarted | ||
| close(handlerWait) |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes I think we can remove drainStarted, move <-inHandler out of the second goroutine between the two goroutines and add a sleep before close(handlerWait).
This way the handler would start, unblock <-inHandler, start the goroutine to drain, sleep in the test func so that Drain will run the loop a few times before close(handlerWait) lets the handler finish.
Edit: We could even add a select to check whether <-drainResult has received a value before this sleep passes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
/lgtm |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.