Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PooledRedisClientManager exception Cannot add unknown client back to the pool exception #37

Closed
GoogleCodeExporter opened this issue Aug 27, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

In multithreaded environement, with multiple pools, my script throw
"Cannot add unknown client back to the pool exception" exception from 
DisposeClient.

it seems when client had exceptions, there is a call to DisposeConnection()
but when the client is disposed, DisposeClient is called.

ClientManager need to be set to null in DisposeClient ?

Original issue reported on code.google.com by jeanmari...@gmail.com on 3 Sep 2010 at 4:53

@GoogleCodeExporter
Copy link
Author

I don't suppose there is anyway to write a script to replicate this bug is 
there?

In order to ensure this bug stays fixed it would be nice to have a test case 
that exhibits these bugs.

Original comment by demis.be...@gmail.com on 3 Sep 2010 at 6:13

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

you can run this with a redis server on local default port.
multiple connections with the pool, wait 10 secs, then shutdown !
thanks

using System;
using ServiceStack.Redis;
using System.Threading;

namespace Test
{
    class Program
    {
        public static void Stuff() {
            while(true) {
                try {
                    using(RedisClient rc = (RedisClient)pool.GetClient()) {
                        rc.Set<DateTime>("test",DateTime.Now);
                    }
                }
                catch (Exception e) {
                    Console.WriteLine(e.Message);
                }
                Thread.Sleep(10);
            }
        }

        public static PooledRedisClientManager pool;
        public static void Main(string[] args)
        {
            pool = new PooledRedisClientManager();
            try {
                Thread[] ths = new Thread[100];
                for(int i=0;i<ths.Length;i++) {
                    ths[i]=new Thread(new ThreadStart(Stuff));
                    ths[i].Start();
                }
                Console.WriteLine("running, waiting 10secs..");
                Thread.Sleep(10000);
                using(RedisClient rc = (RedisClient)pool.GetClient()) {
                    Console.WriteLine("shutdown redis !");
                    rc.Shutdown();
                }
            }
            catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }
    }
}

Original comment by jeanmari...@gmail.com on 4 Sep 2010 at 10:35

@GoogleCodeExporter
Copy link
Author

Hi Thanks for this, I've got new builds attached that hopefully resolves this 
issue.

Let me know how it goes.

Cheers,
D

Original comment by demis.be...@gmail.com on 5 Sep 2010 at 12:40

Attachments:

@GoogleCodeExporter
Copy link
Author

Fixed ! thanks a lot !

Original comment by jeanmari...@gmail.com on 8 Sep 2010 at 11:37

@GoogleCodeExporter
Copy link
Author

Sweet good to know, closing.

Original comment by demis.be...@gmail.com on 8 Sep 2010 at 11:40

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant