-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[browser][webSocket] Data Loss in ClientWebSocket.ReceiveAsync after server initiated close #96359
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsDescriptionIn a C# Blazor WebAssembly (WASM) application where multiple threads aren't utilized, there's an issue with the ClientWebSocket's ReceiveAsync method. Initially, data is received successfully. However, due to extended processing time for preceding data, the server disconnects before subsequent data can be retrieved using ReceiveAsync. Strangely, at the JavaScript layer, it's evident that the subsequent data has arrived (confirmed via WebSocket data in browser network captures). How can this scenario be effectively addressed? Reproduction Steps
Expected behavior
Actual behavior
Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsDescriptionIn a C# Blazor WebAssembly (WASM) application where multiple threads aren't utilized, there's an issue with the ClientWebSocket's ReceiveAsync method. Initially, data is received successfully. However, due to extended processing time for preceding data, the server disconnects before subsequent data can be retrieved using ReceiveAsync. Strangely, at the JavaScript layer, it's evident that the subsequent data has arrived (confirmed via WebSocket data in browser network captures). How can this scenario be effectively addressed? Reproduction Steps
Expected behavior
Actual behavior
Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
cc @pavelsavara |
I think we are talking about blocking UI thread for too long. |
Yes, if you block the main thread for long enough your connection may drop. This isn't something we can fix if it's due to blocking the main thread. However, future optimizations may make your processing fast enough to avoid dropping the connection on faster machines. Have you tested using AOT? |
More questions
|
This issue has been marked |
@pavelsavara
@kg |
So, this is not about CPU hog or about timeouts. |
Yes, I am using Net8 for testing. After the websocket server is disconnected, ClientWebSocket ReceiveAsync cannot read messages that were not read before the disconnection. |
I confirmed that my implementation in Net7, Net8 was too naive, sorry. Will see how easy it would be to backport to Net8 bit later. |
@imxcstar could you please validate that the issue is fixed for Net9 ? cc @ilonatommy |
@pavelsavara alright, everything's sorted out now. 😀 |
Fixed by #99673 |
Description
In a C# Blazor WebAssembly (WASM) application where multiple threads aren't utilized, there's an issue with the ClientWebSocket's ReceiveAsync method. Initially, data is received successfully. However, due to extended processing time for preceding data, the server disconnects before subsequent data can be retrieved using ReceiveAsync. Strangely, at the JavaScript layer, it's evident that the subsequent data has arrived (confirmed via WebSocket data in browser network captures). How can this scenario be effectively addressed?
Reproduction Steps
demo git
Expected behavior
Actual behavior
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: