c# client hangs on shutdown

bradrover brking at gmail.com
Tue Jul 17 19:11:09 UTC 2007


I can not get a clean .Net app shutdown for a simple console app. I can not
call Shutdown on the IO pool until the process is unloading because my class
library is used by many kinds of applications, including web apps. The
problem seems to me that the c# memcached client code creates the
maintenance thread as a foreground thread. Unfortunately this prevents me
from ever getting an AppDomain.ProcessExit event where I can call
SockIOPool.GetInstance().Shutdown(); Obviously I can change my copy of the
published c# client code to work this way, but is there some reason this was
made as a foreground thread ? Sorry if this is not the right list, but the
c# client forum is very very dead.

Sample code below will hang forever using the published c# client code:

    class Program
    {
        static void Main(string[] args)
        {
            InitCache();
            AppDomain.CurrentDomain.ProcessExit += new
EventHandler(CurrentDomain_ProcessExit);
            Thread.Sleep(2000);
            Console.WriteLine("End");
        }

        static void CurrentDomain_ProcessExit(object sender, EventArgs e)
        {
            Console.WriteLine("Process Exit");
            SockIOPool.GetInstance().Shutdown();
        }


        static void InitCache()
        {
            string[] serverlist = { "172.20.17.37:11211" }; // dev-cache-01
            SockIOPool pool = SockIOPool.GetInstance();
            pool.SetServers(serverlist);
            pool.Initialize();
        }


    }
-- 
View this message in context: http://www.nabble.com/c--client-hangs-on-shutdown-tf4098576.html#a11654798
Sent from the memcached mailing list archive at Nabble.com.



More information about the memcached mailing list