It seems there is a race condition bug using StackExchange.Redis that is not released on Nuget.
https://github.com/StackExchange/StackExchange.Redis/issues/38
Waiting the fix, could be great to inject an instance of ConnectionMultiplexer. Something like this:
GlobalHost.DependencyResolver.UseMyRedis(myConnectionMultiplexerInstance,"myeventkey");
Maybe is enough an overload.
here http://stackoverflow.com/questions/25416562/stackexchange-redis-with-azure-redis-is-unusably-slow-or-throws-timeout-errors another example of the problem
Hello @imperugo,
The race condition you are talking about has been fixed on the StackExchange.Redis repo and is in the latest Nuget package, 1.0.371.
There is another issue that was introduced by that change: StackExchange/StackExchange.Redis/pull/129
It causes things like reconnects to sometimes fail because it takes a long time. Hopefully they will accept the change and make a new package with it soon.
I'm not sure what you mean about injecting an instance of the ConnectionMultiplexer. Could you please clarify?
Hi @BrennanConroy
you are right, I've to be more specific :+1:
In my application I'm using StackExchange.Redis also for other caching stuff, it means I already have an instance of ConnectionMultiplexer.
You extension method UseRedis()
requires connection credentials and, inside RedisConnection.cs creates a new instance of ConnectionMultiplexer.
It seems to have two different ConnectionMultiplexer connected to the same instance cause some problems, in fact SignalR throw this exception:
The last error (500) says:
[RedisConnectionException: No connection is available to service this operation: EVAL]
Microsoft.AspNet.SignalR.Messaging.ScaleoutStream.Send(Func`2 send, Object state) +86
Microsoft.AspNet.SignalR.Infrastructure.Connection.Send(ConnectionMessage message) +359
Microsoft.AspNet.SignalR.Transports.TransportConnectionExtensions.SendCommand(ITransportConnection connection, String connectionId, CommandType commandType) +385
Microsoft.AspNet.SignalR.PersistentConnection.ProcessRequestPostGroupRead(HostContext context, String groupsToken) +760
Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod(Func`4 func, T1 arg1, T2 arg2, T3 arg3) +61
I created my extension method with my RedisConnection.cs class that basically is the same of your, but mine has an overload that allow me so specify an instance ConnectionMultiplex.
In this case the connection is the same (could be also a singleton registration into a DI) for SignalR and my stuff and there aren't error.
Does it make sense for you?
If you agree I can create a PR with the overload.
I agree. I would like to have an overload of UseRedis that takes a ConnectionMultiplexer instance.
@imperugo please do create a PR and send it through. Always much easier to discuss real code :smile:
Hi @DamianEdwards
I've changed the code but I can't send the PR because the tests are not getting green.
The problem is that I can't also run the tests on your code (current master on github).
Any hint?
Any progress on that PR? @imperugo
We should it possible to easily derive from RedisConnection
and change the behaviors on there (basically, make all the members virtual). Then we should add an .UseRedis(RedisConnection connection)
extension method to allow the app to pass a pre-created object in.
I think it might be necessary to slightly change additional behavior. For example, as SignalR is currently creating its own connection, it is allowed that is closes and disposes it. If we use a shared connection, we might disrupt other users of that same shared connection if SignalR just closes it.
@imperugo I am having the exact same problem getting "RedisConnectionException: No connection is available to service this operation: EVAL" when I try to enable a Redis backplane. Did you found a workaround?
We are also seeing this issue and need the ability to specify more than one redis server so we can fail over seemlessly when a server is unavailable. Is this still slated for delivery with 2.2.1?
Hi,
We experienced the same error message: No connection is available to service this operation: EVAL
The message misleads me. It was due to a missing network access.
Any updates?
+1
1+
@imperugo I am having the exact same problem getting "RedisConnectionException: No connection is available to service this operation: EVAL" when I try to enable a Redis backplane.
+1
+1
Anything new on this? We are having the same issue.
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!
I see a little bit of activity on this thread still. The original topic was regarding adding an overload to UseRedis that allows a ConnectionMultiplexer to be passed in, but futher discussions indicated there were error messages. If you're seeing an error, please file a new issue describing the situation. Hope that helps!
Hi,
there are news about using SignalR with ConnectionMultiplexer so use a Redis Cluster to scaleout?
+1 - any news on using SignalR with ConnectionMultiplexer so use a Redis Cluster to scaleout?
EDIT: Disregard, I was confusing ASP.NET SignalR and ASP.NET Core SignalR.
This is supported. There's a property on RedisOptions
: ConnectionFactory
that allows you to configure your own connection. The factory you provide must accept a TextWriter
, that writer is ready to be used as the TraceWriter and will auto-forward to our logging infrastructure).
@anurse , so are you saying that Signalr Full Framework now supports connecting to a Redis Cluster?
(the documentation says it doesn't)
I'm sorry, I got this all confused :). I linked to docs for ASP.NET Core SignalR.
We don't have anything tracking using a custom ConnectionMultiplexer in ASP.NET SignalR. If that's of value, I'd suggest filing a new issue since this one got a little side-tracked.
We're currently struggling with a production deployment that is performing terribly. With sky high CPU, and a relatively small workload... constant timeout exceptions.
All using all-latest versions of full framework Signalr, Stackexchange.Redis, Redis backplane. We've implemented all your documented Performane recommendations on IIS servers..
We don't know how to get in touch with anyone to help.
Unless you are seeing Redis performance problems, I don't think switching to Redis Cluster will do you any benefit here. Why don't you file a new issue (feel free to tag me in it) and we'll start there. We don't have a formal SLA around answering these issues on GitHub (for that you'd need to go through Microsoft Developer Support) but we'll do our best.