Comments (2)
I did some debugging and (I might be completely wrong) here are my thoughts
There is long running GET (SSE) request.
- This requests creates a
HttpConnectionContext
object and registers it inHttpConnectionManager
-- This line creates some connection internal stuff including
ApplicationTask
which is completed once the connection closes
- And this line waits for the connection to close and then removes it from
HttpConnectionManager
- so after all this happens the connection is removed from the manager
- This line creates some connection internal stuff including
Once the client calls stop
there is a new POST request with MessageType=Close
- This call is processed by
HttpConnectionDispatcher.ProcessSend
but the connection does not exist anymore
Now the question is who closes the long running SSE connection. From looking into ts client sources it seems that it is a client that closes SSE connection
HubConnection.stop() -> HubConnection._stopInternal() => HttpConnection.stop() -> HttpConnection._stopInternal() => ServerSentEventsTransport.stop() -> ServerSentEventsTransport._close()
Now the issue seems to be a race-condition/not awaiting _sendCloseMessage()
in HubConnection._stopInternal()
I will try to build custom client/reproduce it reliably using some network limiting in a browser.
I don't know what a proper solution should be. There is intentional comment/eslint to not await a close message. Also it does not feel right to have two "independent" methods to do conceptually the same thing.
from aspnetcore.
I was able to reliably reproduce the issue by adding a middleware like this
app.Use(async (context, next) =>
{
await Task.Delay(500);
await next();
});
here is a repository with a sample https://github.com/omorsky-pcor/signalr_close_404
from aspnetcore.
Related Issues (20)
- .NET 8 Blazor - Cannot submit the form because no form on the page currently has that name. HOT 3
- Expose `OutputCachePolicyBuilder.AddPolicy(IOutputCachePolicy)` as `public`
- Update the Blazor WebAssembly perf benchmarks to use a different docker image
- InputNumber bound to int? fails to validate when its content is emtpy
- Blazor Web assembly string injection is slow HOT 2
- How To: .NET 8 Blazor Web App + API + EntraId - how to authorize to SignalR
- Inconsistent namespaces
- Perf improvement: ApiCrudListProducts
- UseRateLimiter() does not work when called after UseMvc() HOT 1
- [Aot] Incorrect serialization when async api HOT 9
- Perf improvement: fortunes, mapaction
- Perf regression: plainTextEmptyFilter
- Microsoft.AspNetCore.Components.NavigationException:“Exception_WasThrown” HOT 4
- [9.0-preview.4] Remove x-aspnetcore-id from OpenAPI responses
- [9.0-preview.4] OpenAPI response does get served if a static file with the same path exists as a file HOT 10
- When using the alpine:latest base image in Docker with .NET Core 8.0, the DateTime format may not work correctly. HOT 4
- ActionResult OK returns 204 on an empty payload instead of 200
- [9.0-preview.4] OpenAPI operations are missing the ID HOT 1
- Best Practices - Call Blazor base lifecycle method first / always HOT 2
- [9.0-preview.5] Endpoint with nullable parameter no longer generates code with Request Delegate Generator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspnetcore.