Skip to content

Duplicate key issue in ServiceStack.Redis & ServiceStack.Redis.Core library #686

@prasantapaul

Description

@prasantapaul

Hi,

We have purchased the Business Developer (Redis) license and using both ServiceStack.Redis & ServiceStack.Redis.Core library in our different projects.

Recently we countered a duplicate key issue while connecting Google Memorystore Redis through the ServiceStack.Redis & ServiceStack.Redis.Core library.

The error message is given below:
An item with the same key has already been added. Key: used_memory_rss

It seems that Google has introduced a new section in Info with the few keys which are same as keys under Memory section (screenshot below).

image

From the codebase in Github we found that the keys are beings inserted in a dictionary object (RedisNativeClient.cs). As there are duplicate keys so the following code block is throwing the above-mentioned error.

public Dictionary<string, string> Info
       {
           get
           {
               var lines = SendExpectString(Commands.Info);
               var info = new Dictionary<string, string>();

               foreach (var line in lines
                   .Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries))
               {
                   var p = line.IndexOf(':');
                   if (p == -1) continue;


                   info.Add(line.Substring(0, p), line.Substring(p + 1));
               }

               return info;
           }
       }

Could you please fix this for both ServiceStack.Redis & ServiceStack.Redis.Core library and release the updated version in nuget asap. We are unable to run our applications (which are in production server) without this fix.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions