csredis icon indicating copy to clipboard operation
csredis copied to clipboard

select & mono - The requested feature is not implemented.

Open bonesoul opened this issue 11 years ago • 11 comments

Using csredis with mono.

Using sync client - and select command

                // create the connection
                Client = new RedisClient(_config.Host, _config.Port)
                {
                    ReconnectAttempts = 3,
                    ReconnectWait = 200
                };

Client.Select(_config.DatabaseId);

Getting;


any ideas?

bonesoul avatar Sep 02 '14 15:09 bonesoul

removed the select call but still getting more errors;

18:16:11 [Error] [RedisProvider] [Dogecoin] An exception occured while getting version info: The requested feature is not implemented.
18:16:11 [Error] [RedisProvider] [Dogecoin] Redis storage initialization failed: 10.0.0.13:6379 - Object reference not set to an instance of an object

I was able to use CSRedis with mono with this commit - https://github.com/ctstone/csredis/tree/6667063d156bf04673449996b4f3560918631c4c but seems a change after broke it.

bonesoul avatar Sep 02 '14 15:09 bonesoul

The latest releases use SocketAsyncEventArgs for faster async performance... I wonder if Mono supports that?. I'll try to setup a Mono debug environment to see what's going on.

On Tue, Sep 2, 2014 at 11:18 AM, Hüseyin Uslu [email protected] wrote:

removed the select call but still getting more errors;

18:16:11 [Error] [RedisProvider] [Dogecoin] An exception occured while getting version info: The requested feature is not implemented. 18:16:11 [Error] [RedisProvider] [Dogecoin] Redis storage initialization failed: 10.0.0.13:6379 - Object reference not set to an instance of an object

I was able to use CSRedis with mono with this commit - https://github.com/ctstone/csredis/tree/6667063d156bf04673449996b4f3560918631c4c but seems a change after broke it.

— Reply to this email directly or view it on GitHub https://github.com/ctstone/csredis/issues/22#issuecomment-54167519.

ctstone avatar Sep 02 '14 16:09 ctstone

https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs seems so?

bonesoul avatar Sep 02 '14 16:09 bonesoul

What version/platform of Mono are you using? I am able to run Select() and Auth() using Mono for Windows 3.2.3 and build 3.2.1 of csredis.

Do you have a full stack trace?

ctstone avatar Sep 02 '14 17:09 ctstone

Ok, I have repro'd on a Linux VM. Here is the offending stack:

System.NotImplementedException: The requested feature is not implemented.
  at System.Net.EndPoint.Serialize () [0x00000] in <filename unknown>:0
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
  at CSRedis.Internal.RedisConnector.Connect () [0x00000] in <filename unknown>:0
  <snip>

Here is the EndPoint.Serialize() definition, and it is indeed undefined: https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/EndPoint.cs#L49

CSRedis uses a DnsEndpoint which does not override base EndPoint.Serialize(): https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/DnsEndPoint.cs

Mono's Socket.Connect() appears to correctly handle IPEndPoint, which does implement Serialize: https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/IPEndPoint.cs#L153

Here is the originating Connect() call: https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Sockets/Socket_2_1.cs#L1215

ctstone avatar Sep 02 '14 17:09 ctstone

what's your mono version?

bonesoul avatar Sep 02 '14 17:09 bonesoul

Is there any fix on your mind? csredis is the only c# redis package that was able to run on linux/mono.

bonesoul avatar Sep 02 '14 18:09 bonesoul

You can try the Develop branch using your own EndPoint (specifically, an IPEndPoint):

var ep1 = new IPEndPoint(IPAddress.Parse("x.x.x.x"), Port); // via IP
var ep2 = new IPEndPoint(Dns.GetHostEntry("yourname").AddressList[0], Port); // via lookup
var redis = new RedisClient(ep1);

Not quite ready to push these changes to the Master branch, but I'm curious to know if this workaround works for you.

ctstone avatar Sep 02 '14 18:09 ctstone

getting this with develop branch;

{"Could not load file or assembly 'csredis, Version=3.1.0.0, Culture=neutral, PublicKeyToken=1afd0264bbe4a44a' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)":"csredis, Version=3.1.0.0, Culture=neutral, PublicKeyToken=1afd0264bbe4a44a"}

bonesoul avatar Sep 02 '14 21:09 bonesoul

@ctstone , yes endpoint fix worked;

                // for mono compatibility, we need to define an endpoint.
                var endpoint = new IPEndPoint(IPAddress.Parse(_config.Host), _config.Port); 

                // create the connection
                Client = new RedisClient(endpoint)
                {
                    ReconnectAttempts = 3,
                    ReconnectWait = 200
                };

bonesoul avatar Sep 02 '14 21:09 bonesoul

fwiw still had this issue on mono 4.2.1. workaround fixed it beautifully, thx.

pracplayopen avatar Apr 11 '18 03:04 pracplayopen