Repository navigation
Uncaught (in promise) DOMException: The user aborted a request. when Virtualize cancels the gRPC-Web call (Blazor WASM, net7 regression) #80696
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When using gRPC-Web (Grpc.Net.Client.Web) call to server from Virtualize.ItemsProvider and Virtualize cancels the call, the browser sometimes (race-condition?) fails with Uncaught (in promise) DOMException: The user aborted a request.

Sometimes, the Virtualize component continues working, sometimes it is kept broken.
The issue was introduced starting net7.0, when I downgrade the project to net6.0, the issue disappears.
Expected Behavior
Correct handling of the request cancellation (without any browser error).
(If the error is caused by incorrect Grpc.Net.Client.Web implementation, the WASM/Blazor still should fail with regular exception and not with this type of DOM error.)
Steps To Reproduce
repro: https://github.com/hakenr/VirtualizeGrpcRepro
Start the project.
Scroll the list quickly up/down/up/down/..., the issue usually appears within few seconds.
If not reproduced, try to set browser CU throttling to 6x slowdown, the issue will appear much more likely.

Exceptions (if any)
Uncaught (in promise) DOMException: The user aborted a request.
oa @ dotnet.7.0.2.tt5z2s8frk.js:5
_bound_js_INTERNAL_http_wasm_abort_response @ _bound_js_INTERNAL_h…sm_abort_response:7
Ss @ dotnet.7.0.2.tt5z2s8frk.js:5
_mono_wasm_invoke_bound_function @ dotnet.7.0.2.tt5z2s8frk.js:14
$func313 @ 00992bd6:0x1d40d
$func283 @ 00992bd6:0x1c906
$func221 @ 00992bd6:0xdff6
$func220 @ 00992bd6:0xce95
$func8115 @ 00992bd6:0x1a2195
$func2054 @ 00992bd6:0x85bba
$func2059 @ 00992bd6:0x86222
$func2086 @ 00992bd6:0x882e1
$mono_wasm_invoke_method_bound @ 00992bd6:0x9c6c
Module._mono_wasm_invoke_method_bound @ dotnet.7.0.2.tt5z2s8frk.js:14
Ws @ dotnet.7.0.2.tt5z2s8frk.js:5
b.javaScriptExports.complete_task @ dotnet.7.0.2.tt5z2s8frk.js:5
(anonymous) @ dotnet.7.0.2.tt5z2s8frk.js:5
Promise.catch (async)
Kr @ dotnet.7.0.2.tt5z2s8frk.js:5
_bound_js_INTERNAL_http_wasm_get_streamed_response_bytes @ _bound_js_INTERNAL_h…d_response_bytes:10
Ss @ dotnet.7.0.2.tt5z2s8frk.js:5
_mono_wasm_invoke_bound_function @ dotnet.7.0.2.tt5z2s8frk.js:14
$func313 @ 00992bd6:0x1d40d
$func283 @ 00992bd6:0x1c906
$func221 @ 00992bd6:0xdff6
$func220 @ 00992bd6:0xce95
$func8115 @ 00992bd6:0x1a2195
$func2054 @ 00992bd6:0x85bba
$func2059 @ 00992bd6:0x86222
$func2086 @ 00992bd6:0x882e1
$mono_wasm_invoke_method_bound @ 00992bd6:0x9c6c
Module._mono_wasm_invoke_method_bound @ dotnet.7.0.2.tt5z2s8frk.js:14
Ws @ dotnet.7.0.2.tt5z2s8frk.js:5
b.javaScriptExports.complete_task @ dotnet.7.0.2.tt5z2s8frk.js:5
(anonymous) @ dotnet.7.0.2.tt5z2s8frk.js:5
Promise.then (async)
Kr @ dotnet.7.0.2.tt5z2s8frk.js:5
_bound_js_INTERNAL_http_wasm_fetch_bytes @ _bound_js_INTERNAL_h…wasm_fetch_bytes:15
Ss @ dotnet.7.0.2.tt5z2s8frk.js:5
_mono_wasm_invoke_bound_function @ dotnet.7.0.2.tt5z2s8frk.js:14
$func313 @ 00992bd6:0x1d40d
$func283 @ 00992bd6:0x1c906
$func221 @ 00992bd6:0xdff6
$func220 @ 00992bd6:0xce95
$func8115 @ 00992bd6:0x1a2195
$func2054 @ 00992bd6:0x85bba
$func2052 @ 00992bd6:0x85b30
$func1395 @ 00992bd6:0x68681
$func313 @ 00992bd6:0x1d491
$func283 @ 00992bd6:0x1c906
$func221 @ 00992bd6:0xdff6
$func220 @ 00992bd6:0xce95
$func8115 @ 00992bd6:0x1a2195
$func2054 @ 00992bd6:0x85bba
$func2059 @ 00992bd6:0x86222
$func2086 @ 00992bd6:0x882e1
$mono_wasm_invoke_method_ref @ 00992bd6:0x9bd1
Module._mono_wasm_invoke_method_ref @ dotnet.7.0.2.tt5z2s8frk.js:14
_Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_BeginInvokeDotNet @ _Microsoft_AspNetCor…eginInvokeDotNet:29
beginInvokeDotNetFromJS @ blazor.webassembly.js:1
b @ blazor.webassembly.js:1
invokeMethodAsync @ blazor.webassembly.js:1
(anonymous) @ blazor.webassembly.js:1
(anonymous)
.NET Version
7.0.2
Anything else?
I published the repro to https://VirtualizeGrpcRepro.azurewebsites.net
Activity
hakenr commentedon Jan 11, 2023
...you can "avoid" the error if you sacrifice the cancellation, i.e if you don't pass the
cancellationTokenfrom Virtualize's request to the gRPC client call:Replace¨
with
MackinnonBuck commentedon Jan 13, 2023
@pavelsavara do you know what might be going on here?
I confirmed that this bug repros when using a
net7.0target framework, but everything works correctly onnet6.0. The following line is what's causing the browser error:runtime/src/mono/wasm/runtime/http.ts
Line 24 in dce09aa
That line was introduced as part of #66304.
pavelsavara commentedon Jan 13, 2023
The ReadableStreamDefaultReader.cancel() returns Promise which throws.
I will fix it next week, probably just ignoring the "The user aborted a request." reason.