Skip to content

Uncaught (in promise) DOMException: The user aborted a request. when Virtualize cancels the gRPC-Web call (Blazor WASM, net7 regression) #80696

Closed

Description

@hakenr

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.
image

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.
2023-01-10_22-51-09

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

  1. hakenr commented on Jan 11, 2023

    @hakenr
    MemberAuthor

    ...you can "avoid" the error if you sacrifice the cancellation, i.e if you don't pass the cancellationToken from Virtualize's request to the gRPC client call:

    Replace¨

    var result = await MyService.DoSomethingAsync(new(), request.CancellationToken);

    with

    var result = await MyService.DoSomethingAsync(new(), CancellationToken.None);
  2. MackinnonBuck commented on Jan 13, 2023

    @MackinnonBuck
    Member

    @pavelsavara do you know what might be going on here?

    I confirmed that this bug repros when using a net7.0 target framework, but everything works correctly on net6.0. The following line is what's causing the browser error:

    res.__reader.cancel();

    That line was introduced as part of #66304.

  3. pavelsavara commented on Jan 13, 2023

    @pavelsavara
    Member

    The ReadableStreamDefaultReader.cancel() returns Promise which throws.

    I will fix it next week, probably just ignoring the "The user aborted a request." reason.

    res.__reader.cancel().catch(() => { });
    
  4. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Jan 16, 2023
  5. transferred this issue fromdotnet/aspnetcoreon Jan 16, 2023
  6. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jan 16, 2023
  7. added
    arch-wasmWebAssembly architecture
    and removed
    untriagedNew issue has not been triaged by the area owner
    on Jan 16, 2023
  8. added this to the 7.0.x milestone on Jan 16, 2023
  9. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Jan 19, 2023
  10. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Jan 24, 2023
  11. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Feb 9, 2023
  12. ghost locked as resolved and limited conversation to collaborators on Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions