-
Notifications
You must be signed in to change notification settings - Fork 494
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
CosmosClient causes Blazor WASM to deadlock on net7 #3599
Comments
related? dotnet/aspnetcore#45233 |
@y2kbugger If the process is deadlocked, then a profiler should be able to show the place where the deadlock is happening. The fact that this only happens on NET7 and it works fine on NET6 means there is some change in the implementation that is causing it, because the SDK is not changing in-between and it targets NETStandard2.0, there is no NET6 or NET7 specific code that it uses, it relies entirely on the implementation of the NETStandard2.0 interface. If you can find where the deadlock is happening, we can help, but based on the output of the console in your test, it is not the client creation (otherwise it would not print "Created client"). |
I've made an issue with the aspnetcore team as well as a minimal reproduction repository. https://github.com/y2kbugger/ReproduceDeadlockIssueBlazorWasmNet7 Run the project with
Goto the counter page and put in the key
and click the button. It's a read-only key for an empty throwaway DB, but they are really serious about a fully working bug reproduction or else they will close issue. |
Sorry didn't mean to close.... |
|
That line is not relevant. What that line does is remove the Default Trace Listener if it's attached. The Default Trace Listener is a Trace Listener that generates lock contention under heavy load and it's inefficient. The Default Trace Listener would not generate a lock like the one you are describing. Default Trace Listener is mostly enabled in NET FX + IIS environments. When it is enabled, and the machine is under heavy load, if the SDK is generating Traces, it will generate high CPU consumption due to the lock it internally has, that is why it is advised to remove it. |
Any idea how to profile/track down a deadlock that occurs within a WASM environment? |
Honestly no, I would reach out to the WASM team for that, I am no expert on profiling WASM. Maybe asking on the other issue you are tracking. |
Personally, I wouldn't recommend using CosmosClient in a Blazor environment. Instead, create a function app REST API that the Blazor environment uses. This helps keep things locked down. I know this is an alternative to the issue you are reporting, but it could be helpful. |
.Net 7: It creates client and then goes to sleep on await FeedIterator.ReadNextAsync() |
y2kbugger this issue requires more information for the team to be able to help. In case this information is available, please add it and re-open the Issue. |
Microsoft doesn't agree. Accessing directly from the browser is part of their use case as shown by the CORS documentation:
|
Websites can be reverse engineered. That is why I use a REST layer. Also, you would have to expose a key vault for user-based interactions. Nothing can be exposed this way. |
Obviously, but not everyone is building internet facing apps for mass adoption. Some people are replacing vba macros built by interns and which are used by 3 people for a specific task and doesn't contain any trade secrets. My point is that people have different use cases and "I don't do it that way for my needs" isn't a helpful answer to broken software. |
Describe the bug
When newing up a
CosmosClient
(either as DI services or in async callback on a page) the entire browser tab will deadlock.This does not occur when I retarget the app to .net6
Seems similar to #1429 and I have tried various combinations of injecting a separate
HttpClient
via() => new HttpClient()
andLimitToEndpoint = true
To Reproduce
Steps to reproduce the behavior. If you can include code snippets or links to repositories containing a repro of the issue that can helps us in detecting the scenario it would speed up the resolution.
Expected behavior
No hang
Actual behavior
Browser tab hangs completely, can't even right-click/inspect. If I open the developer console before calling the code, e.g. via a button, no error messages are found in console.
Also it is strange to me that the callback continues after the Client is Created but we are just deadlocked.
Environment summary
SDK Version: .net7
OS Version (e.g. Windows, Linux, MacOSX): windows
Additional context
In his blog Jermery Likness states
https://blog.jeremylikness.com/blog/azure-ad-secured-serverless-cosmosdb-from-blazor-webassembly/
Which is what I'm trying to do.
This is my full csproj file
The text was updated successfully, but these errors were encountered: