Skip to content
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

Uncaught Error: The delegate target that is being invoked is no longer available. Please check if it has been prematurely GC'd. #55679

Closed
k-u-s opened this issue Jul 13, 2021 · 11 comments · Fixed by #56538
Assignees
Milestone

Comments

@k-u-s
Copy link

k-u-s commented Jul 13, 2021

Describe the bug

As originally posted in dotnet/aspnetcore#32386 sometimes when loading/refreshing Blazor wsam site that uses signalr connection it fails with message from title. But I do not think it is resolved in net6. This error is somewhe inside
HubConnection.StartAsync(CancellationToken cancellationToken = default). Also wrom whar I observed this exception is not propageted. So if you have something like:

try{ await hc.StartAsync();}
catch{}
finally{}

catch and finally block are never called.

To Reproduce

Similar as in: dotnet/aspnetcore#32386

Exceptions (if any)

Uncaught Error: The delegate target that is being invoked is no longer available. Please check if it has been prematurely GC'd.
invoke_delegate https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_unbox_delegate_rooted https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_set_object_property https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_EndInvokeJS https://mono-wasm.invalid/managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_EndInvokeJS:16
endInvokeJSFromDotNet https://domain.com/_framework/blazor.webassembly.js:1
beginInvokeJSFromDotNet https://domain.com/_framework/blazor.webassembly.js:1
promise callbackbeginInvokeJSFromDotNet https://domain.com/_framework/blazor.webassembly.js:1
ct https://domain.com/_framework/blazor.webassembly.js:1
_mono_wasm_invoke_js_blazor https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_call_method_with_converted_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
call_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
set_task_result https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
promise callback
js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
mono_wasm_convert_return_value https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_js_with_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_call_method_with_converted_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
call_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
set_task_result https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
promise callback*js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
mono_wasm_convert_return_value https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_js_with_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
dotnet.6.0.0-preview.5.21301.5.js:1:203039

image

Further technical details

ASP.NET Core version: .NET6-previev5

Image is build using tools from

Digest: sha256:789b28fbee1c28b2c637e5b1dcbc54f93bbcd01db1481447dfaccb79f8bd3fae
Status: Downloaded newer image for mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim

And run inside:

mcr.microsoft.com/dotnet/runtime-deps:6.0-bullseye-slim
Digest: sha256:37068731bf9ae0789e1d28f8d75ac52c7ef4d88e7b81574caa7017ebc8fe0320
Status: Downloaded newer image for mcr.microsoft.com/dotnet/runtime-deps:6.0-bullseye-slim


Thanks for the additional details. Given that we haven't received any other similar feedback we're closing this issue as per your statement it's working correctly in .NET 6.

Originally posted by @mkArtakMSFT in dotnet/aspnetcore#32386 (comment)

@BrennanConroy
Copy link
Member

@kg

@kg
Copy link
Contributor

kg commented Jul 13, 2021

This is in Google Chrome, right? (by the look of the devtools screenshot). Do you know which specific version? The stack trace you provided is very strange to me, many of the functions in the traceback don't ever call each other.

@k-u-s
Copy link
Author

k-u-s commented Jul 14, 2021

Its ff:

image

But it also happened in Edge 91 but i do not have screenshots from it.

@kg
Copy link
Contributor

kg commented Jul 14, 2021

OK, thanks. We can just assume the stack traces being weird is an FF problem and worry about that separately.

@k-u-s
Copy link
Author

k-u-s commented Jul 14, 2021

Below screen from Edge:

image

@kg
Copy link
Contributor

kg commented Jul 14, 2021

That's very helpful, thank you! It confirms my theory for what's going on here.

@k-u-s
Copy link
Author

k-u-s commented Jul 14, 2021

Usually I was able to get this error in about 10 min (around 20 page refresh). But after changing:

try{ await hc.StartAsync();}
catch{}
finally{}

to something like:

try{
var delayTask = Task.Delay(15_000);
var startTask = hc.StartAsync();
await Task.WhenAny(delayTask , startTask );
if(!startTask.IsCompletedSuccessfully)
throw new Exception();
}
catch{}
finally{}

I was not able to get this error in since 3h. But since its hard to reproduce it, not sure if that helped or I was just lucky.

@BrennanConroy
Copy link
Member

@lewing should we transfer the issue to Runtime?

@BrennanConroy BrennanConroy transferred this issue from dotnet/aspnetcore Jul 14, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jul 14, 2021
@lewing lewing added arch-wasm WebAssembly architecture and removed untriaged New issue has not been triaged by the area owner labels Jul 14, 2021
@ghost
Copy link

ghost commented Jul 14, 2021

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Describe the bug

As originally posted in dotnet/aspnetcore#32386 sometimes when loading/refreshing Blazor wsam site that uses signalr connection it fails with message from title. But I do not think it is resolved in net6. This error is somewhe inside
HubConnection.StartAsync(CancellationToken cancellationToken = default). Also wrom whar I observed this exception is not propageted. So if you have something like:

try{ await hc.StartAsync();}
catch{}
finally{}

catch and finally block are never called.

To Reproduce

Similar as in: dotnet/aspnetcore#32386
Its hard to

Exceptions (if any)

Uncaught Error: The delegate target that is being invoked is no longer available. Please check if it has been prematurely GC'd.
invoke_delegate https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_unbox_delegate_rooted https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_set_object_property https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_EndInvokeJS https://mono-wasm.invalid/managed__Microsoft_AspNetCore_Components_WebAssembly__Microsoft_AspNetCore_Components_WebAssembly_Services_DefaultWebAssemblyJSRuntime_EndInvokeJS:16
endInvokeJSFromDotNet https://domain.com/_framework/blazor.webassembly.js:1
beginInvokeJSFromDotNet https://domain.com/_framework/blazor.webassembly.js:1
promise callbackbeginInvokeJSFromDotNet https://domain.com/_framework/blazor.webassembly.js:1
ct https://domain.com/_framework/blazor.webassembly.js:1
_mono_wasm_invoke_js_blazor https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_call_method_with_converted_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
call_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
set_task_result https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
promise callback
js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
mono_wasm_convert_return_value https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_js_with_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_call_method_with_converted_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
call_method https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
set_task_result https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
promise callback*js_to_mono_obj https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
mono_wasm_convert_return_value https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
_mono_wasm_invoke_js_with_args https://domain.com/_framework/dotnet.6.0.0-preview.5.21301.5.js:1
dotnet.6.0.0-preview.5.21301.5.js:1:203039

image

Further technical details

ASP.NET Core version: .NET6-previev5

Image is build using tools from

Digest: sha256:789b28fbee1c28b2c637e5b1dcbc54f93bbcd01db1481447dfaccb79f8bd3fae
Status: Downloaded newer image for mcr.microsoft.com/dotnet/sdk:6.0-bullseye-slim

And run inside:

mcr.microsoft.com/dotnet/runtime-deps:6.0-bullseye-slim
Digest: sha256:37068731bf9ae0789e1d28f8d75ac52c7ef4d88e7b81574caa7017ebc8fe0320
Status: Downloaded newer image for mcr.microsoft.com/dotnet/runtime-deps:6.0-bullseye-slim


Thanks for the additional details. Given that we haven't received any other similar feedback we're closing this issue as per your statement it's working correctly in .NET 6.

Originally posted by @mkArtakMSFT in dotnet/aspnetcore#32386 (comment)

Author: k-u-s
Assignees: pavelsavara
Labels:

arch-wasm

Milestone: -

@pavelsavara
Copy link
Member

Have simpler steps to reproduce here #55735

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 4, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants