Signalr: Memory leak

Created on 2 Nov 2015  路  9Comments  路  Source: SignalR/SignalR

After 3 month that my signlar self host was run,i found that the process get 1.5 gigabyte memory.We use version 2.1.1 of signalr.
I check it with Dot memory and i found that Microsoft.AspNet.SignalR.Messaging.DefaultSubscription getting more memory and don't release.

Is this memory leak?

Most helpful comment

Second to that. It seems that it fills memory with strings like hc-Realtime.20e13545-e77c-4873-9d55-fe9c14e3a058
(guid varies by instance of course), but after few minutes of profiling, I have few hundreds instances of string same as that that in memory

memleak

seems though that this memory is retained when client is disconnected (at least partially). But since in our scenario the clients are connected for rather long time (generally you could say 24/7) the memory stress is increasing constantly.

All 9 comments

untitled

Second to that. It seems that it fills memory with strings like hc-Realtime.20e13545-e77c-4873-9d55-fe9c14e3a058
(guid varies by instance of course), but after few minutes of profiling, I have few hundreds instances of string same as that that in memory

memleak

seems though that this memory is retained when client is disconnected (at least partially). But since in our scenario the clients are connected for rather long time (generally you could say 24/7) the memory stress is increasing constantly.

How big are the messages?

we're trying to keep them small - in last run, in average 300 chars (payload), with max of 1742 chars (we send just plain strings, no json on signalr side), sometimes it peeks up to say 5k

image

I seem to have the same problem (v2.2.0). Running now for three days, and DefaultSubscription instances are steadily increasing.

We are experiencing the same problem here. How to fix this kind of issue? (Memory leak)

That original dot trace profile looks suspicious. Why are there so many message bus instances. There should be one.

We are seeing the same here. (v2.2.0)

My tests show that it seems to be related to pinned memory that the GC cannot collect. When our application is exposed to 1-2K customers connecting in a short period of time memory seems to be pinned very fast. I even received some OutOfMemoryExceptions in busy hours.

Ants profiler shows that the unused memory allocated to .NET is growing steady. It points to byte array used in Microsoft.AspNet.SignalR.Messaging.Message

ants_profile_signalrapp

How can we circumvent this ? Is it possible to tweak initial buffer sizes or message chunk size through the API or something like that?

This issue has been closed as part of issue clean-up as described in https://blogs.msdn.microsoft.com/webdev/2018/09/17/the-future-of-asp-net-signalr/. If you're still encountering this problem, please feel free to re-open and comment to let us know! We're still interested in hearing from you, the backlog just got a little big and we had to do a bulk clean up to get back on top of things. Thanks for your continued feedback!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OfirYemini picture OfirYemini  路  10Comments

VrindiTeam picture VrindiTeam  路  3Comments

iqmeta picture iqmeta  路  4Comments

thedutchess picture thedutchess  路  4Comments

JoergTiedemann picture JoergTiedemann  路  3Comments