-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Blazor reconnection tests are broken #12788
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
Comments
Yeah, I'm trying to work out how to simulate a non-graceful disconnection on the tests. If we don't find a way we might need to test the feature in some other way. |
I've been trying to use an alternative approach to enable these tests. I've replaced the IHttpUpgrade feature so that I can provide my own test stream that allows me to introduce errors in the application. I've been trying different approaches:
I haven't managed to create a condition where the connection appears to go bad from the SignalR perspective (manage websocket will always throw an exception saying connection closed prematurely and we will catch and silently ignore it, disconnecting gracefully). This makes me put in perspective several things about the feature:
I'm currently trying to correctly read the WebSocket header payload but cause an error after that to see if that causes an issue. I also plan to recruit help from someone on the SignalR team to see if we can get to something reasonable, but at this point I'm concerned that ungraceful disconnections get confused with "graceful ones" (closing the browser, refreshing the page, navigating away) and that we dispose circuits to aggressively as a result. |
I'd go further and check we can prove it's even possible in the real world, not just tests.
We ought to be sure that disgraceful disconnects are the common case (except when genuinely closing the browser/tab), otherwise we've invested a lot into a feature that will never be used. |
There is a different technical solution here, which is to only do a "graceful disconnect" when we receive the beacon from an unload handler. That bypasses all the uncertainty about whether the network traffic is right about whether the user really intended to disconnect. Drawbacks to using beacon:
|
I went over and spoke to @anurse and @BrennanConroy about this One way we can trigger a bad disconnect would be to call abort on the context on the server. They are not sure if there's another way to do it that would work in tests. |
Reconnection wouldn't work either.
Re-connection is best effort and we can always remove the circuits in a FIFO fashion.
If the browser crashes I think it would be treated as a graceful disconnect in the current scenario.
I still think there are ways we can cause it to be ungracefully terminated, the main thing is that it won't be treated as ungraceful unless you are in the middle of receiving a message.
I plan to physically try some of these things:
Update:
Although we can make sure the feature works, we need to better understand the scenarios E2E to make sure there is no situation in which it can have issues where a temporary disconnect gets interpreted as a graceful one. |
Yes that's my point exactly. On browser crash, the current implementation would discard the circuit, whereas a beacon-based one wouldn't. |
Moving the discussion about whether reconnection actually works to #12828 Let's now use this issue only to discuss the state of the E2E tests, not the actual product code. |
These tests are currently broken in release/3.0
@javiercn made changes this morning that implement circuit cleanup on graceful disconnect. However, our reconnection tests trigger a graceful reconnect - which cleans up the circuit and prevents reconnection.
We have no reason to believe anything is wrong in the product at this point. When you fix this, look for skipped tests with a link to this issue.
The text was updated successfully, but these errors were encountered: